I am using :before=> function to validate the fields in the form, but
the problem is that it does not update the div test_categories, instead
opens as a separate page like regular form. If I remove this :before=>
all works fine.
the function hello is below and just a normal js
function hello()
{
The other thing i'd suggest is to look up the API for form remote tag and ensure that you explicitly put all your brackets, parenthesis and braces... I think ruby might be interpreting your URL string as a hash... Can you look at the HTML source generated and email it to us?
Thanks
The problem is that before => does not prevent form submission and
Julian was right about the inclusion of the return. However removing
the return runs the JavaScript hello() function but does not cancel
form submission.
Instead you should use the :condition => filter;
:condition => "$('card_no').value != ''",
This will check the value of card_no and if empty will not submit the
form, otherwise the form is submitted and the test_categories div
updated. If any of the JavaScript code is invalid then a standard http
request will be made. This is why it opens a separate page like
regular form.