Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.3.2

Request #13088 using ajax i can't validate
Submitted: 2008-02-08 11:15 UTC
From: vizzz Assigned: avb
Status: Closed Package: HTML_QuickForm2 (version 0.2.0)
PHP Version: 5.2.4 OS: Linux
Roadmaps: 0.4.0    
Subscription  


 [2008-02-08 11:15 UTC] vizzz (Andrea Visinoni)
Description: ------------ I'm using ajax to fill options of a <select> based on the event onchange of another <select>, when i submit the form i can't see in $form->getValue(); data from the ajax populated select. Test script: --------------- $fsText->addElement('text', 'txMatricola', array('style' => 'width: 300px;'), array('label' => 'Matricola:')); $fsText->addElement('select', 'selProduttore', array('style' => 'width: 200px;','onchange' => 'makeRequest(\'getmodelsbyprod.php\', \'selModello-0\',this.value)'), array('options' => $data_prod, 'label' => 'Produttore:')); $fsText->addElement('select', 'selModello', array('style' => 'width: 200px;'), array('label' => 'Modello:')); $fsText->addElement('submit', 'btSubmit', array('value' => 'Invia')); $fsText->addElement('hidden', 'hidValue'); Expected result: ---------------- i expect to see even an "selModello" entry in the array of results after validate. Actual result: -------------- array(5) { ["_qf__matricola"]=> string(0) "" ["txMatricola"]=> string(3) "abc" ["selProduttore"]=> string(1) "2" ["btSubmit"]=> string(5) "Invia" ["hidValue"]=> string(0) "" }

Comments

 [2008-02-09 10:22 UTC] avb (Alexey Borzov)
You need to fill the select's options server-side as well. getValue() checks whether the values could possibly be submitted by the given <select> and returns nothing as there are no options at all.
 [2008-02-09 14:48 UTC] mansion (Bertrand Mansion)
I think that we will have to make intrinsic validation optional for this kind of stuff.
 [2010-01-11 22:44 UTC] avb (Alexey Borzov)
-Roadmap Versions: +Roadmap Versions: 0.4.0
See also bug #16974 for a possible fix
 [2010-01-27 01:56 UTC] avb (Alexey Borzov)
-Status: Open +Status: Closed -Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: avb
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. It is now possible to pass 'intrinsic_validation' => false in $data array to Select constructor.