Ajax insertion into a form

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 :

<%= start_form_tag :action => ‘create’ %>
<%= render_partial ‘form’ %>


<%= link_to_remote("Add a number",
                     :update =>'telephone', :position=> :after)

<%= text_field_tag ‘telephone’ %>

<%= submit_tag “Create” %>
<%= end_form_tag %>

The controller :
def new

def new_tel
@[email protected]_num.succ
session[:num_tels][email protected]_num
render (:text=>"
"[email protected]_num.to_s+’<input
id=“telephone”’[email protected]_num.to_s+’ name=“telephone”[email protected]_num.to_s
type=“text” />’)

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

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.


Le 2 févr. 06 à 11:01, Gerret A. a écrit :

Thanks, great tool ! And of course the glitch was in my code ^^

Man, I was sooooo looking foward to this Aardvark plug-in.
However, it appears it is not compatible with FF (which my FF
automatically updated with last night).


Oh well, maybe soon???


Hi Damon,

Here is a great firefox extension for viewing the rendered source.


Also if you want to see your ajax requests, it would suggest Julien
Couvreur’s greasemonkey script at:


Hope this can help out,

Damon H. wrote:

On 2/2/06, Pierre Gambarotto <[email protected]
> The browser’s “view source” will display the page source as

Rails mailing list
[email protected]

Eric G.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs