rascal
asked on
How to handle VBScript of Form's OnSubmit?
If a form's OnSubmit handler is a javascript function, it can return FALSE to prevent the form from being submitted.
But in my environment I have VBScript as my script language so when I created the onsubmit handler (via double clicking on the form's onsubmit entry in the script outline in Visual Interdev) it creates an onsubmit SUB instead of a function.
How then do I indicate an error had occured and that the form should not be submitted?
But in my environment I have VBScript as my script language so when I created the onsubmit handler (via double clicking on the form's onsubmit entry in the script outline in Visual Interdev) it creates an onsubmit SUB instead of a function.
How then do I indicate an error had occured and that the form should not be submitted?
i don't know what your code looks like, but if you run into an error, and you don't want the form to submit, try
window.event.returnValue = false;
or you can make your submit into <input type="button">
and then have an onClick event for the button which calls some sub or function and if whatever validation or whatever fails then don't do anything, and if you want the form to submit, then
frmName.submit() 'submits form
------------
by having action="" or by not specifing an action, all you do is have the form submit to itself instead of some specified page.
let me know if that doesn't work for you because i don't usually work with vbscript, except for my asp coding.
window.event.returnValue = false;
or you can make your submit into <input type="button">
and then have an onClick event for the button which calls some sub or function and if whatever validation or whatever fails then don't do anything, and if you want the form to submit, then
frmName.submit() 'submits form
------------
by having action="" or by not specifing an action, all you do is have the form submit to itself instead of some specified page.
let me know if that doesn't work for you because i don't usually work with vbscript, except for my asp coding.
ASKER
Thank you very much! That worked and was much cleaner than what I was using in that it did not navigate to itself in case of an error, it just canceled the onsubmit.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER