Re: QuickForm - javascript alert
| From: | Damien Cros | Date: | Fri, 09 Dec 2005 10:55:45 +0000 |
| Subject: | Re: QuickForm - javascript alert | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22186@lists.php.net to get a copy of this message | ||
I would do that:
$form->addElement('checkbox', 'mychkname', 'mychklabel', NULL, array('id'=>'mychkname'));
in the php file
and in javascript:
document.getElementById('mychkname').onclick = function {
if ( !document.getElementById('mychkname').checked)
alert('you have unchecked this chekbox');
}
hope this helps,
Damien
On 9 déc. 05, at 05:04, Graham Clarke wrote:
Attachment: [application/pkcs7-signature] smime.p7s
Hi - I'm trying to get a simple javascript alert to appear if a user leaves a checkbox unchecked. Not a required field, just a warning that it is unchecked. Any suggestions? Thanks Graham --Graham Clarke grahamc@53tech.com www.53tech.com 603.643.9955 --PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Attachment: [application/pkcs7-signature] smime.p7s