After an ajax insertion in the dom, it seems the browser don''t refresh its knowledge of the page. The source of the page is identical after the insertion, whereas the display is correct. The ajax insertion is used to add an input field. The added fields are ignored by the submission of the form. Isn''t it possible to do that, or maybe there''s a problem in my code ? The view : new.rhtml <%= start_form_tag :action => ''create'' %> <%= render_partial ''form'' %> <p><label for="telephone">Telephone</label> <%= link_to_remote("Add a number", :url=>{:action=>''new_tel''}, :update =>''telephone'', :position=> :after) %> <br/> <%= text_field_tag ''telephone'' %></p> <%= submit_tag "Create" %> <%= end_form_tag %> The controller : def new session[:num_tels]=0 end def new_tel @tel_num=session[:num_tels] @tel_num=@tel_num.succ session[:num_tels]=@tel_num render (:text=>"<br/>"+@tel_num.to_s+''<input id="telephone"''+@tel_num.to_s+'' name="telephone"+@tel_num.to_s type="text" />'') end
You mean that the display of your page changes as expected, but when you do a "view source", the new input field isnt visible in the source? The browser''s "view source" will display the page source as downloaded, and not as inferred from the DOM. If you want to view an HTML version of the current DOM (say, after your AJAX update), I recommend the Aardvark plugin for firefox. It lets you select any container on the page (like your form element), and view its source as inferred from the DOM. cheers Gerret On 2/2/06, Pierre Gambarotto <pierre.gambarotto@enseeiht.fr> wrote:> After an ajax insertion in the dom, it seems the browser don''t > refresh its knowledge of the page. > > The source of the page is identical after the insertion, whereas the > display is correct. > > The ajax insertion is used to add an input field. The added fields > are ignored by the submission of the form. > > Isn''t it possible to do that, or maybe there''s a problem in my code ? > > > The view : > > new.rhtml > <%= start_form_tag :action => ''create'' %> > <%= render_partial ''form'' %> > <p><label for="telephone">Telephone</label> > > <%= link_to_remote("Add a number", > :url=>{:action=>''new_tel''}, > :update =>''telephone'', :position=> :after) > %> > <br/> > <%= text_field_tag ''telephone'' %></p> > <%= submit_tag "Create" %> > <%= end_form_tag %> > > The controller : > def new > session[:num_tels]=0 > end > > def new_tel > @tel_num=session[:num_tels] > @tel_num=@tel_num.succ > session[:num_tels]=@tel_num > render (:text=>"<br/>"+@tel_num.to_s+''<input > id="telephone"''+@tel_num.to_s+'' name="telephone"+@tel_num.to_s > type="text" />'') > end > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Le 2 f?vr. 06 ? 11:01, Gerret Apelt a ?crit :> You mean that the display of your page changes as expected, but when > you do a "view source", the new input field isnt visible in the > source? > > The browser''s "view source" will display the page source as > downloaded, and not as inferred from the DOM. If you want to view an > HTML version of the current DOM (say, after your AJAX update), I > recommend the Aardvark plugin for firefox. It lets you select any > container on the page (like your form element), and view its source as > inferred from the DOM. >Thanks, great tool ! And of course the glitch was in my code ^^ http://www.karmatics.com/aardvark/
Man, I was sooooo looking foward to this Aardvark plug-in. However, it appears it is not compatible with FF 1.5.0.1 (which my FF was automatically updated with last night). :( Oh well, maybe soon??? ~damon On 2/2/06, Pierre Gambarotto <pierre.gambarotto@enseeiht.fr> wrote:> > > Le 2 f?vr. 06 ? 11:01, Gerret Apelt a ?crit : > > > You mean that the display of your page changes as expected, but when > > you do a "view source", the new input field isnt visible in the > > source? > > > > The browser''s "view source" will display the page source as > > downloaded, and not as inferred from the DOM. If you want to view an > > HTML version of the current DOM (say, after your AJAX update), I > > recommend the Aardvark plugin for firefox. It lets you select any > > container on the page (like your form element), and view its source as > > inferred from the DOM. > > > Thanks, great tool ! And of course the glitch was in my code ^^ > http://www.karmatics.com/aardvark/ > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060202/ffde95bd/attachment.html
Hi Damon, Here is a great firefox extension for viewing the rendered source. http://jennifermadden.com/scripts/ViewRenderedSource.html Also if you want to see your ajax requests, it would suggest Julien Couvreur''s greasemonkey script at: http://blog.monstuff.com/archives/images/XMLHttpRequestDebugging.v1.2.user.js Hope this can help out, Eric Damon Hill wrote:> Man, I was sooooo looking foward to this Aardvark plug-in. > However, it appears it is not compatible with FF 1.5.0.1 > <http://1.5.0.1> (which my FF was automatically updated with last night). > > :( > > Oh well, maybe soon??? > > ~damon > > On 2/2/06, *Pierre Gambarotto* <pierre.gambarotto@enseeiht.fr > <mailto:pierre.gambarotto@enseeiht.fr>> wrote: > > > Le 2 f?vr. 06 ? 11:01, Gerret Apelt a ?crit : > > > You mean that the display of your page changes as expected, but > when > > you do a "view source", the new input field isnt visible in the > > source? > > > > The browser''s "view source" will display the page source as > > downloaded, and not as inferred from the DOM. If you want to > view an > > HTML version of the current DOM (say, after your AJAX update), I > > recommend the Aardvark plugin for firefox. It lets you select any > > container on the page (like your form element), and view its > source as > > inferred from the DOM. > > > Thanks, great tool ! And of course the glitch was in my code ^^ > http://www.karmatics.com/aardvark/ > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Eric Goodwin http://www.ericgoodwin.com