QuickForm - either choose value from option-select or type in value in textbox

From: Date: Tue, 13 Apr 2004 11:51:52 +0000
Subject: QuickForm - either choose value from option-select or type in value in textbox
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11818@lists.php.net to get a copy of this message
Hi I need a form where the user should be able to do one of the following: 1. Choose a value from a drop-down menu (SELECT) 2. Type in a value in a text field This means if the user chooses a value from the drop-down menu the text-field should be disabled and vice versa. Furthermore it is necessary that one of the choices has been made when the form is submitted meaning that I need some kind of validation (client- and serverside) that either the user has chosen a value from the drop-down menu or typed in a value in the text field. How am I to accomplish this using QuickForm? Right now I'm using the following form fields for the purpose: $tmp['url'] =& new HTML_QuickForm_select('url_automatic', 'Automatic URL:'); $tmp['url']->addOption('Nothing', 'none'); $tmp['url']->loadQuery($db, 'SELECT tpl_name, pagetitle FROM tpl_page ORDER BY pagetitle', 'pagetitle', 'tpl_name'); $form->addElement($tmp['url']); $form->addElement('text', 'url_manual', 'Manual URL:'); I hope you can help me out here - Thanks in advance :-) Cheers, Tommy Ipsen

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