Re: QuickForm installer bug? + Can't display values

From: Date: Sat, 01 Jun 2002 09:53:41 +0000
Subject: Re: QuickForm installer bug? + Can't display values
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1557@lists.php.net to get a copy of this message
<stirado@campus.gym.itesm.mx> wrote : > > At 10:09 AM 5/31/2002 +0200, you wrote: >> le 31/05/02 2:21, Sergio Tirado à stirado@campus.gym.itesm.mx a écrit : >> >>> Once that was working, I found some problems with one of the two >>> examples included. I had to comment out a few lines related to >>> <select> and form validation to get it working. >> >> Which example are you talking about ? 1 or 2 ? > > Example 1. I had to comment out this lines: > > //$select = &$form->getElement('iselTest'); > //$select->setSize(5); > //$select->setMultiple(true); Check your version of HTML_Common in the HTML directory and update it to the latest release. QuickForm makes extensive use of this class. >>> Despite all that, I started playing with it and looks great too, however, >>> once I made the form I wanted, I can use it to get values from it but >>> I haven't found a way to get it to display values I have retrieved from >>> a database. ¿Could someone tell me how to do this? >> >> Do you use setDefaults ? Look at the example 1. > > Right now I'm doing this and it shows record info the first time only. > > require_once("HTML/QuickForm.php"); > > if ($_POST["action"]=="Add") { > $uid = ""; > } else { > $p_key = "L00263822"; > list($uid,$did,$n,$ln) = $u->get($p_key); // Load the record info > } > > $form =& new HTML_QuickForm("$PHP_SELF","POST"); > $form->addElement('text', 'frm_uid', "User Id", > "size='9', maxlength='9' > value='$uid'"); > $form->addElement('select', 'frm_did', 'Dept:', > array('Admon'=>'A', > > 'Dirección'=>'B','UIB'=>'C','Prepa'=>'D')); > $form->addElement('text', 'frm_n', 'Name:', > "size='30', maxlength='30' > value='$n'"); > $form->addElement('text', 'frm_ap', 'Last name:', > "size='30', maxlength='30' > value='$ln'"); > $form->addElement('submit', 'action', 'Add'); > $form->addElement('submit', 'action', 'Remove'); > $form->display($body); This is all wrong. To set the values you have to use either setDefaults($array of key-value pairs) (when the form is displayed for the first time) or loadValues() (when the form has errors). The way you declare your attributes is also wrong. Get rid of the quotes or use an array instead (example: array('size'=>30, 'maxlength'=>30) or string: 'size=30 maxlength=30'. Do not set the value of your elements in the attributes (even if this is possible :-) > I tried setDefaults yesterday but it wasn't working. I'll give it a try again > and report on results. > >> What version of php do you use ? > > php-4.1.2-7. Haven't found php-4.2.1-0.i386.rpm yet. > >> Can you try to install Auth with pear installer and report if it installs >> everything in the same directory or create the container directory as >> expected or if it does the same thing as with QuickForm. >> >> I reported a bug for that yesterday. There's nothing else I can do about it. > > I installed Auth as you requested > > [root@www root]# pear install http://pear.php.net/get/Auth > install ok: Auth 1.0.2 > > Under my /usr/share/pear/Auth directory I can see this: > > [root@www Auth]# ls -l > total 48 > -rw-r--r-- 1 root root 19238 May 31 09:56 Auth.php > -rw-r--r-- 1 root root 2731 May 31 09:56 Container.php > -rw-r--r-- 1 root root 8199 May 31 09:56 DB.php > -rw-r--r-- 1 root root 3229 May 31 09:56 File.php > -rw-r--r-- 1 root root 5695 May 31 09:56 LDAP.php > > So it did it again: It is not creating sub-directories. OK, this is the evidence that the latest version of the pear installer is bogus. I have sent a bug report yesterday but have had no comment of any kind since. Good luck, Bertrand Mansion Mamasam

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