Re: QuickForm - adding Javascript Confirm
| From: | Charles Kline | Date: | Tue, 20 Sep 2005 11:16:36 +0000 |
| Subject: | Re: QuickForm - adding Javascript Confirm | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21053@lists.php.net to get a copy of this message | ||
On Sep 17, 2005, at 11:01 AM, Stoyan Stefanov wrote:
Hi Charles, Something like this should do: $form->addElement('checkbox', 'delete', null, 'Delete this thing', array('onclick' => 'this.checked=confirm("Checking this box will delete the thing! Do you really want to delete?")')); Stoyan On 9/17/05, Charles Kline <ckline@rightcode.net> wrote:Stoyan, Thank you. This is just what I was looking for. I ended up using a slightly different option for this, checking only when "checked" and not every time it is clicked: $form->addElement('checkbox', 'delete', 'Delete',null, array('onClick' => "if (this.checked) alert('Delete?');")); - CharlesIs there a way to add a javascript confirm to a QuickForm? I have a delete checkbox that I want to have a confirm alert if it is submitted when that box is checked. No clue how to set that up. - Charles