Forum: Ruby Form validation issue in form_remote_tag

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
31caecd97fb56c008e240a8707409c14?d=identicon&s=25 Ruby Quest (rubyquest)
on 2007-01-25 15:10
In one of my application part, I am validating 'not null' check of
particular field of my form before submitting the form. The javascript
function 'validateTitle' does it correctly. but what my problem is the
form page gets reloaded and there is nothing on the page EXCEPT response
string in the "Respbox" div. I want to retain the form fields as it is,
after submitting form.

what is the problem in my code???? any help is appreciated..

------My form tag is simillar to below code--------

<div id="Respbox" style="align:center"></div>

<%= form_remote_tag :url => { :action => 'create' },:before => 'return
validateTitle()' ,:update => 'Respdiv'  %>

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

<%= submit_tag "Add " %>

<%= end_form_tag %>

--------My Javascript code -----------------

function validateTitle()

var title = document.getElementById("item_title").value
  if(title.length == 0 )
    alert("Item Title cannot be empty");
  return false;

This topic is locked and can not be replied to.