|
Posted by John Dunlop on 10/06/59 11:38
Taras_96:
> document.getElementById('searchForm').submit()
[...]
> However, in the latter case, the $_POST['submitButton'] variable is not
> set, even though the form was submitted by clicking on the submit
> button!
Your inkling was right. The form wasn't submitted using the submit
button but by the javascript function submit(), because onsubmit
returned false, and so the name-value pair of the submit button was not
sent as part of the form data, the submit button not being a
'successful control'.
> One [workaround] I can think of is having a hidden input called 'formSubmitted'
> which is initially set to false, and prior to calling submit() on the form, you
> set this input to true, and you can test to see if this value is true in addition to
> testing if $_POST['submitButton'] is set:
Only concern is that it relies on javascript to toggle the hidden
value, but then maybe that's neither here nor there since you appear
to be relying heavily on javascript already. I would think a hidden
input of some sort is the way to go.
--
Seoc
Navigation:
[Reply to this message]
|