# Form\_remote\_tag :condition

**URL:** <https://www.ruby-forum.com/t/form-remote-tag-condition/105107>\
**Category:** Rails\
**Created:** [May 25, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/form-remote-tag-condition/105107 "2007-05-25T20:45:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![namwob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/35a633/32.png) [@namwob](https://www.ruby-forum.com/u/namwob)\
**Post date:** [May 25, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/form-remote-tag-condition/105107/1 "2007-05-25T20:45:33Z")

</div>

I am using the following validation prototype-based js library:

[http://tetlaw.id.au/view/javascript/really-easy-field-validation](http://tetlaw.id.au/view/javascript/really-easy-field-validation)

What I am trying to do is upon submitting a form via AJAX, I want it  
to meet the conditions of the validation of the function validateMe()

If it passes, go ahead and continue and push the form information via  
an AJAX call. This is what I have:

\<% form\_remote\_tag :update=\>‘nothing’,  
:url=\> {:action =\> ‘create’},  
:condition =\>‘validateMe();’,  
:html=\> {:id=\>‘signIn’},  
:success =\>‘Modalbox.hide();’ do %\>

so the HTML that is generated is:

The validateMe() function works correctly and returns FALSE if it is  
not validated,HOWEVER, if it returns TRUE, the AJAX.updater, does NOT  
get called.

Am I understanding what :condition does? If I were to take  
out :condition, the form works correctly but this skips the validateMe  
function.

---

<div class="post-metadata">

**Author:** ![namwob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/35a633/32.png) [@namwob](https://www.ruby-forum.com/u/namwob)\
**Post date:** [May 25, 2007, 9:23pm UTC](https://www.ruby-forum.com/t/form-remote-tag-condition/105107/2 "2007-05-25T21:23:36Z")

</div>

I found my mistake. I thought that I was returning the correct  
boolean values back to the form from the JS function, but I was not.  
Everything is working perfectly now.
