Forum: Ruby on Rails form_remote_tag does not update div

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeba M. (Guest)
on 2009-03-30 10:44
Hello all,
I'm using a form_remote_tag as:


<% form_remote_tag(:update=>"statdiv",:url => {
:controller=>:ticket,:action => :status }) do %>
  <table width="100%" height="100%" class="loginbox">
     <tr>
       <td>
           E-mail
       </td>
       <td>
           <%= text_field 'ticket', 'email' ,'id'=>'email' ,
:size=>30,:maxlength=>30,:class=>"field" %>
       </td>
     </tr>
     <tr>
       <td>
           <%= submit_tag "View Status" ,:class=>"bttn"
,:onclick=>"return statuscheck();" %>
       </td>
     </tr>
  </table>
<%end %>
<div id="statdiv">
</div>

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.
Siddick E. (Guest)
on 2009-03-30 10:51
I think, the /ticket/status.rhtml contain a tag with the id as
"statdiv".
Check-it-out.
Jeba M. (Guest)
on 2009-03-30 10:57
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....   :(
The div does not get updated...
Siddick E. (Guest)
on 2009-03-30 11:19
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('');" )
Jeba M. (Guest)
on 2009-03-30 11:28
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...   :)
Thanks anyways.
This topic is locked and can not be replied to.