on 10/05/2009 03:02 PM Philip Thompson said the following:
>>> I try to avoid the use of hidden form elements as much as possible,
>>> especially for tracking whether a user has submitted a form or not...
>>> I use name="submit" for the submit button instead, that will pass the
>>> value of the submit button to the action script.
>>> above all i use a template engine, smarty to take care of the
>>> presentation for me(like deciding whether to show the form and/or a
>>> success/failure message)
>> That only works if the user clicks on that submit button. If the user
>> hits the enter key in a text input, the form is submitted but the submit
>> input variable is not set. That is why an hidden input is a safer
>> solution.
> If you need the button to be *clicked*...
> <form onsubmit="$('submitButton').fireEvent('click');" ...>
> Or something along those lines.

That does not make much sense and is pointless. First that syntax you
mentioned probably requires JQuery or some other large Javascript
library. something like this['submitButton'].click() would emulate the
click event. Second, by the time that onsubmit is called, the event that
 triggered it was already dispatched. Emulating the click on a button
would probably fire the form submission and onsubmit code would be run
again, leading to an infinite loop sucking machine CPU.


Manuel Lemos

Find and post PHP jobs

PHP Classes - Free ready to use OOP components written in PHP

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to