# Form validation issue in form\_remote\_tag

**URL:** <https://www.ruby-forum.com/t/form-validation-issue-in-form-remote-tag/83359>\
**Category:** Ruby\
**Created:** [January 25, 2007, 3:26pm UTC](https://www.ruby-forum.com/t/form-validation-issue-in-form-remote-tag/83359 "2007-01-25T15:26:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubyquest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@rubyquest](https://www.ruby-forum.com/u/rubyquest)\
**Post date:** [January 25, 2007, 3:26pm UTC](https://www.ruby-forum.com/t/form-validation-issue-in-form-remote-tag/83359/1 "2007-01-25T15:26:24Z")

</div>

In one of my application, I am using form validation check for  
particular form field before submitting the form. The javascript  
validation method “validateTitle()” does it work properly. But what my  
problem is, the page gets reloaded after submitting the form and there  
is nothing on the page EXCEPT response message in the “Respbox” div.

I want to retain my form as it is, after submitting the form(Of course,  
with response message).

What is the problem in my code??? Any help is appreciated…

---------My form is simillar to this-----------

\<%= form\_remote\_tag :url =\> { :action =\> ‘create’ },:before =\> ‘return  
validateTitle()’ ,:update =\> ‘Respbox’ %\>

---------my form fields go here------------

\<%= submit\_tag “Add” %\>

\<%= end\_form\_tag %\>

-----------My javascript function--------------  
function validateTitle()  
{

var title = document.getElementById(“item\_title”).value  
if(title.length == 0 )  
{  
alert(“Item Title cannot be empty”);  
return false;  
}

}
