QF: exportValue() and silly error possibly ....

From: Date: Mon, 15 Dec 2003 23:47:55 +0000
Subject: QF: exportValue() and silly error possibly ....
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9543@lists.php.net to get a copy of this message
Hello pear-general, Ok, going on in my understanding of QF/QFC, I think I am getting close to grasp the fundamental concepts. there is one thing that puzzles me, regarding exportValue/ExportValues for radiobutton groups in the project I am developing. I suppose there is something which I am missing, maybe right in my nose, but can't find it. I have a QFC with 3 pages. In the first of them, I declare and add to form a radiobutton group as follows, in its buildForm method .... $radioGroup[] = &HTML_QuickForm::createElement('radio', 'stato', null, 'Attiva', 'Attiva'); $radioGroup[] = &HTML_QuickForm::createElement('radio', 'stato', null, 'Disattiva', 'Disattiva'); $this->addGroup($radioGroup, null, 'Stato della Licita', ' '); .... blah blah blah My intention is to set the 2 radiobuttons as an HTML group so that the'll be mutually exclusive. This page also declares 2 submit buttons bound to different actions. The first is supposed to be a global submit button , and for now it simply prints the $page->controller->exportValues; the relevant printout is as follows ... ["stato"]=> string(9) "Disattiva" so far, so good. In the second submit method (meant to just save the contents of the active page and go back to it), I try to get the values of the elements to save (radiobutton group included) in the following way(s): $page->exportValue('stato')); $page->controller->exportValue('relevantPage', 'stato'); but I get back a HTML_QuickForm_Error telling me that the element does not exist. This rather puzzles me, because in the code lines above, I retrieved all the other relevant elements' data in the same way without a hitch; AND the printout for the other method (the one for "global" submit) does work. So I must assume that somehow, exportValues knows how to traverse correctly the datastructure, while exportValue() seems not to. I tried giving the radiobutton group a name, and still the ....->exportValues works, while the two different versions of exportValue do not. last thing I could try is to get them like $gr = &$page->getElement('group_name_of_radios'); $elems = &$gr->getElements(); then running through each of their isChecked() methods and finding out its value, but I suspect that there is a quicker and more robust way of getting the info I need (and without extracting the value of the "radio" element from the $page->controller->exportValues()'s dead body :) ) At the moment, I solutioned it like this: $temp = $page->controller->exportValues(); $radiobutton_value = $temp['stato']; but I think it's overkill. so ... what am I missing? TIA, -- Best regards, Ing. Massimiliano Bariola Cell: ++39 329 3570098 REDLINK Italia S.a.s http://www.redlinkitalia.it mailto:m.bariola@redlinkitalia.it PGP Key: http://www.redlinkitalia.it/PGP/MB_PGPKEY.txt

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