From: Ruby Quest Date: 2007-01-25T23:10:46+09:00 Subject: Form validation issue in form_remote_tag 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--------
<%= 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; } } -- Posted via http://www.ruby-forum.com/.