# Form\_remote\_tag does not update div

**URL:** <https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232>\
**Category:** Rails\
**Created:** [March 30, 2009, 8:44am UTC](https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232 "2009-03-30T08:44:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeba-momin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@zeba-momin](https://www.ruby-forum.com/u/zeba-momin)\
**Post date:** [March 30, 2009, 8:44am UTC](https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232/1 "2009-03-30T08:44:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zeba-momin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@zeba-momin](https://www.ruby-forum.com/u/zeba-momin)\
**Post date:** [March 30, 2009, 8:51am UTC](https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232/2 "2009-03-30T08:51:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zeba-momin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@zeba-momin](https://www.ruby-forum.com/u/zeba-momin)\
**Post date:** [March 30, 2009, 8:57am UTC](https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232/3 "2009-03-30T08:57:23Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![zeba-momin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@zeba-momin](https://www.ruby-forum.com/u/zeba-momin)\
**Post date:** [March 30, 2009, 9:19am UTC](https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232/4 "2009-03-30T09:19:44Z")

</div>

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(’’);” )

---

<div class="post-metadata">

**Author:** ![zeba-momin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@zeba-momin](https://www.ruby-forum.com/u/zeba-momin)\
**Post date:** [March 30, 2009, 9:28am UTC](https://www.ruby-forum.com/t/form-remote-tag-does-not-update-div/164232/5 "2009-03-30T09:28:19Z")

</div>

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.
