R
Ruby Quest
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;
}
}
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;
}
}