![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a form that uses the following: onSubmit="some_var = 'validated';" FireFox is OK with that. Internet Explorer isn't. any ideas why? |
#3
| |||
| |||
|
|
On Jun 1, 10:53 am, Mark Livingstone <namematters... (AT) msn (DOT) com> wrote: I have a form that uses the following: onSubmit="some_var = 'validated';" FireFox is OK with that. Internet Explorer isn't. any ideas why? This code assigns to global variable some_var string value "validated" and then submits the form so causing new page load with the Javascript context being reset: so it doesn't matter what value to what do you assign before that. I don't know what browser and how could be "OK with that" - you have to explain then what does it mean OK and most helpful: what are you trying to achieve overall. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Forgot to mention... if I create a function that assigns a value to some_var and then do onSubmit="function();", everything works fine. It's just that IE doesn't want to recognize onSubmit="some_var = 'value';" or onSubmit="somevar = 1;" syntax. |
#6
| |||
| |||
|
|
On Jun 1, 10:53 am, Mark Livingstone <namematters... (AT) msn (DOT) com> wrote: I have a form that uses the following: onSubmit="some_var = 'validated';" FireFox is OK with that. Internet Explorer isn't. any ideas why? This code assigns to global variable some_var string value "validated" and then submits the form so causing new page load with the Javascript context being reset: so it doesn't matter what value to what do you assign before that. |
#7
| |||
| |||
|
|
VK wrote on 01 jun 2008 in comp.lang.javascript: On Jun 1, 10:53 am, Mark Livingstone <namematters... (AT) msn (DOT) com> wrote: I have a form that uses the following: onSubmit="some_var = 'validated';" FireFox is OK with that. Internet Explorer isn't. any ideas why? This code assigns to global variable some_var string value "validated" and then submits the form so causing new page load with the Javascript context being reset: so it doesn't matter what value to what do you assign before that. This is not always true, VK, try this: form onSubmit="some_var = 'validated';" target='_blank' ... And could be usefully used like this: ========================================== form onSubmit="return submitOnlyOnce()" target='_blank' ... script type='text/javascript' var submitted = false; function submitOnlyOnce() { if (submitted) return false; return submitted = true;}; /script ========================================== |
#8
| |||
| |||
|
|
If some_var is indeed some additional "submission allowed" flag then it could be even: form ... onsubmit="return some_var : validate(this);" |
#9
| |||
| |||
|
|
On Jun 2, 2:17 am, VK <schools_r... (AT) yahoo (DOT) com> wrote: If some_var is indeed some additional "submission allowed" flag then it could be even: form ... onsubmit="return some_var : validate(this);" A rush of typing, sorry, of course: form ... onsubmit="return some_var ? true : validate(this);" or form ... onsubmit="return some_var ? false : validate(this);" depending on some_var being allowing or blocking flag. |
![]() |
| Thread Tools | |
| Display Modes | |
| |