Form_remote_tag does not update div


#1

Hello all,
I’m using a form_remote_tag as:

<% form_remote_tag(:update=>“statdiv”,:url => {
:controller=>:ticket,:action => :status }) do %>

E-mail <%= text_field 'ticket', 'email' ,'id'=>'email' , :size=>30,:maxlength=>30,:class=>"field" %>
<%= submit_tag "View Status" ,:class=>"bttn" ,:onclick=>"return statuscheck();" %>
<%end %>

The problem I’m facing is that the from_remote_tag just inserts the
/ticket/status.rhtml text into the ‘statdiv’ div each time instead of
updating it.

It does not clear the ‘statdiv’ each time “View Status” button is
pressed.So if there is text from the previous from submit in ‘statdiv’,
it remains as it is and new text is inserted above it into the
‘statdiv’.
What I want is that the ‘statdiv’ should be cleared each time of its old
text.
Is from_remote_tag not the right option for this???
Please help.
Thank you.


#2

I think, the /ticket/status.rhtml contain a tag with the id as
“statdiv”.
Check-it-out.


#3

Siddick E. wrote:

I think, the /ticket/status.rhtml contain a tag with the id as
“statdiv”.
Check-it-out.

Thanks for the reply.
I tried it but things are the same… :frowning:
The div does not get updated…


#4

I am not Giving the correct solution, but it will work.

Solution :-
form_remote_tag(:update=>“statdiv”,:url => {
:controller=>“test”,:action => “status” }, :before =>
“$(‘statdiv’).update(’’);” )


#5

Siddick E. wrote:

I am not Giving the correct solution, but it will work.

Solution :-
form_remote_tag(:update=>“statdiv”,:url => {
:controller=>“test”,:action => “status” }, :before =>
“$(‘statdiv’).update(’’);” )

Hey thank you so much for your solution but I got it working by:
<% form_remote_tag(:url => { :controller=>:ticket,:action => :status
},:update=>“statdiv”) do %>

What I needed to do is to specify the :url before the :update… :slight_smile:
Thanks anyways.