Re: QuickForm Controller: how to bind custom action to a button?
| From: | Alexey Borzov | Date: | Sun, 25 Jan 2009 23:13:09 +0000 |
| Subject: | Re: QuickForm Controller: how to bind custom action to a button? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-29645@lists.php.net to get a copy of this message | ||
Hi,
Igor Antokhin wrote:
I am new to PEAR and QuickForm Controller so please excuse my ignorance. Now, to the problem: I am creating a multi-page form, in the first (login) page the user must enter his name/password. I want to provide a logout mechanism on the following pages. This should be a button, clicking on it should destroy the session and re-display the first page. I create my custom logout action, add it to my form, and in e.g. page 2 add the button (code below). This works as expected when clicking the buttons, but if I press Enter on the 2nd page, then instead of going to page 3 the logout action is performed. What do I do wrong?First of all, I have a feeling you are using a wrong tool for the job. A better approach would be to use a separate package (like PEAR::Auth http://pear.php.net/package/Auth ) for handling login and logout, rather than put it into the same form you are using to change data. As for the original question, this is browser dependent, unfortunately. Some browsers consider that no button was clicked when you press Enter and here default action helps, some consider the first button in the form clicked (in your case it is Logout). I think it was discussed before here, and even some workarounds were posted, try searching the archives.