>>In any case, you should use the syntax as described by David Froderick, which is
>>
>>...FORM NAME=Sujet ACTION='anypageevennonexistant' ONSUBMIT='return Go(this)'
>>
>>
>>In this case, 'this' refers to the form. It is perfectly legal in javascript to use the 'this' keyword to refer to an object. You can use it in any object, form field, etc. By using ONSUBMIT, you can control whether the form gets submitted or not, or do any other validation in the function, by returning true (form is submitted to ACTION value), or false (form is not submitted).
>
>There is a particular reason why I do it like this. First of all, the form which is having a javascript call to Go() is not the form which is submitting the data. That is only a form on the page to handle specific operations. The Go() function will initiate a submit on another form as soon as we change some values of some hidden fields on the form to be submitted. Secondly, the function Go() is not a validate function but only an operational function that handles some data before we submit everything.
-----------------------------
You can still use the syntax, even if you do not submit that particular form. Using "ONSUBMIT='return Go(this)'" will allow you to do any work you want (validation, field value changes, submit other forms, etc.) in the function being called. If you submit another form from within the Go function, then the submittal of the original form (the 'caller' of Go) will not happen, because the page will have lost its focus as soon as you submit another form. You can still avoid the submittal of the caller form even if you do not submit another form in Go by simply having the function Go return 'false'.
function Go(frm){
//do your work here, and submit another form
document.form2.submit(); //this page is over once you call this
return false; //just in case, to cancel original form submission
//if you choose NOT to submit another form, for some reason...
return false; //<- will cancel submission of original form
}
Andres M. Chiriboga, MCSE, MCP+I