Quickform - submitting via javascript or submit button

From: Date: Thu, 30 Dec 2004 07:19:51 +0000
Subject: Quickform - submitting via javascript or submit button
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16508@lists.php.net to get a copy of this message
I have a form (http://googolplex.dk/pearform.php) where I am reloading the form using 'onchange="javascript:this.form.submit();"' on a checkbox, and then deciding whether certain elements should be activated: $form->addElement('advcheckbox', 'php', 'PHP', '', 'onchange="javascript:this.form.submit();"', array('no', 'yes')); if ($form->exportValue('php') == 'yes') { $form->addElement('text', 'php_version', 'PHP version'); // etc... } Of course, it would seem a bit silly to validate the form, if its reloaded by 'form.submit()', so I tried to add the rules like this: if ($form->exportValue('send') == 'Godkend') { $form->addRule('aspnet_version', 'Indtast venligst ASP.NET versionen - TEST', 'required'); $form->addRule('php_version', 'Indtast venligst PHP versionen - TEST', 'required'); } (Note: My submit button is <input name="send" value="Godkend" type="submit" />) Of course, this resultet in the form validating immediately when reloaded by 'form.submit()', so I did this: if ($form->validate() && $form->exportValue('send') == 'Godkend') { // Process } But now the form won't process at all, could anyone tell me what I am doing wrong ? Janus Roenne Ps. This is the first time I use Quickform :)

« previous php.pear.general (#16508) next »