onsubmit for remote_form_for not working properly

I want to use onsubmit for a form validation using javascript on remote_form_for

<snip>

but it not works well. if condition return false then my form is not get submitted this is exactly what i want but when it returns true it produce something like this o/p on UI.

Element.update("user_report", "\n\n\u003Ctable class=\"list issues\"\u003E\n \u003Cthead\u003E\u003Ctr\u003E\n \u003Cth\u003E#\u003C/th\u003E\n

I guess this is a JavaScript issue. What about showing us that?

<% remote_form_for :timesheet, @timesheet, :url =>{:action => 'report_user'}, :html => {:onsubmit=>"return ValidateDate();" } do |f|   %>

I guess this is a JavaScript issue. What about showing us that?

Thanx 4 ur reply

No i am just telling what problem i m facing. i just want to know is onsubmit working properly with remote_form_for? and wheather there is any syntax error in my code above ?

Regards, Salil

No, remote_form_for will use the onsubmit event to make the actual AJAX request. So I don't think overriding the onsubmit attribute would be a good idea... :slight_smile:

No, remote_form_for will use the onsubmit event to make the actual AJAX request. So I don't think overriding the onsubmit attribute would be a good idea... :slight_smile:

thanx @David. Do you know what should do in that case to put javascript form validations?

Thanx & Regards Salil

> No, remote_form_for will use the onsubmit event to make the actual > AJAX request. So I don't think overriding the onsubmit attribute would > be a good idea... :slight_smile:

thanx @David. Do you know what should do in that case to put javascript form validations?

The ajax helpers can take a :conditions parameter which is a fragment of javascript to run to check whether the request should go ahead (it's described in the docs for link_to_remote)

Fred