Forum: Ruby on Rails ajax insertion into a form

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Pierre Gambarotto (Guest)
on 2006-02-02 11:53
(Received via mailing list)
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' %>
   <p><label for="telephone">Telephone</label>

    <%= link_to_remote("Add a number",
                         :update =>'telephone', :position=> :after)
<%= text_field_tag 'telephone' %></p>
<%= submit_tag "Create" %>
<%= end_form_tag %>

The controller :
def new

def new_tel
     render (:text=>"<br/>"+@tel_num.to_s+'<input
id="telephone"'+@tel_num.to_s+' name="telephone"+@tel_num.to_s
type="text" />')
Gerret A. (Guest)
on 2006-02-02 12:03
(Received via mailing list)
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.

Pierre Gambarotto (Guest)
on 2006-02-02 18:22
(Received via mailing list)
Le 2 févr. 06 à 11:01, Gerret A. a écrit :

Thanks, great tool ! And of course the glitch was in my code ^^
Damon H. (Guest)
on 2006-02-02 20:08
(Received via mailing list)
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???

Eric G. (Guest)
on 2006-02-02 20:26
(Received via mailing list)
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* <removed_email_address@domain.invalid
>     > The browser's "view source" will display the page source as
> Rails mailing list
> removed_email_address@domain.invalid

Eric G.
This topic is locked and can not be replied to.