paulgami Posted August 17, 2006 Share Posted August 17, 2006 I'm working from one of the examples that comes with PEAR's HTML_QuickForm_Controller (1.0.6) - regWizard.php and all is fine.However, I'd like to add a feature where I present the user with a link that opens a popup to get some information, and then returns the user to the form that now has one of its textfields populated with the result of the processing in the popup. Using a similar method to how some travel sites will have a calendar popup in order to fill in a date field.The relevant portion of the code:[code=php:0]$this->addElement('link','enginepopup','Choose your engine','enginechoice.php','click here');$this->addElement('text','engineModel','Engine Model', array('size' => 30, 'maxlength' => 63));[/code]I'd like for a user to click on the 'enginepopup' link, and have that popup pass back the result into the following text element 'engineModel'.Is that possible? I suspect some javascript is involved, but I'm not sure where to start. I'd appreciate any information.ThanksThe full class for that step of the "wizard":[code=php:0]class Aircraft_Information extends HTML_QuickForm_Page{ function buildForm() { $this->_formBuilt = true; $this->addElement('header', 'data_header', 'Aircraft Information'); $this->addElement('text', 'aircraftMfr', 'Aircraft Manufacturer', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'aircraftModel', 'Aircraft Model', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'aircraftYear', 'Aircraft Year', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'aircraftRegNo', 'Aircraft Registration No.', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'aircraftSerNo', 'Aircraft Serial No.', array('size' => 30, 'maxlength' => 63)); $this->addElement('link','enginepopup','Choose your engine','enginechoice.php','click here'); $this->addElement('text','engineModel','Engine Model', array('size' => 30, 'maxlength' => 63)); $prevnext[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Previous step'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Next step >>'); $this->addGroup($prevnext, 'buttons', '', ' ', false); $this->addRule('aircraftRegNo', 'Aircraft Registration No. is required', 'required'); $this->addRule('aircraftSerNo', 'Aircraft Serial No. is required', 'required'); $this->setDefaultAction('next'); }}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.