Re: QuickForm submit-buttons coupled with verification javascript - how!?
| From: | Tommy Ipsen | Date: | Wed, 02 Jul 2003 18:33:45 +0000 |
| Subject: | Re: QuickForm submit-buttons coupled with verification javascript - how!? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6401@lists.php.net to get a copy of this message | ||
Tommy Ipsen wrote:
Hi I have a form with the following "action" buttons: $buttonsmodify[] = &HTML_QuickForm::createElement('reset', 'reset', 'Reset', array('class' => 'stdbutton')); $buttonsmodify[] = &HTML_QuickForm::createElement('submit', 'delete', 'Delete', array('class' => 'stdbutton')); $buttonsmodify[] = &HTML_QuickForm::createElement('submit', 'update', 'Update', array('class' => 'stdbutton')); $form->addGroup($buttonsmodify); I would like to attach a Javascript prompting the user "Are you sure you want to delete blabla" (Yes/No) if the "Delete" button is pressed. How can I accomplish this? Regards, Tommy Ipsen Found the solution by myself:$buttonsmodify[] = &HTML_QuickForm::createElement('submit', 'delete', 'Delete', array('class' => 'stdbutton', 'onClick' => 'return confirm(\'Are you sure you want to delete blabla?\')'));