RE: [PEAR] Quick_form Select Defaults
| From: | Kilbride, James | Date: | Wed, 26 Oct 2005 20:04:18 +0000 |
| Subject: | RE: [PEAR] Quick_form Select Defaults | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-21651@lists.php.net to get a copy of this message | ||
I printed out the values and saw that it was exactly what I wanted, the
value, not the text. So it was the correct value. But setting the
defaults didn't work. I did find that if i did
$sel =& $activityForm->addElement(select','Area','Activity
Area:',$areas);
//$areas is my array of values and names
$defaults['Area']=$default_val;
$sel->setSelected($defaults['Area']);
// additional fields created and defaults saved into $defaults
$activityForm->setDefaults($defaults);
It works suddenly. Bug in Quick_forms?? Note the fact that I am
specifically using what I set in Defaults to do it so that I could test
if i was using the right value a second way(even after echoing the value
to check).
James Kilbride
> -----Original Message-----
> From: Mark Steudel [mailto:mark@netriver.net]
> Sent: Wednesday, October 26, 2005 3:50 PM
> To: Kilbride, James; pear-general@lists.php.net
> Subject: RE: [PEAR] Quick_form Select Defaults
>
> Nope you are right, it's exactly the same as everything else.
>
> I'm guessing that your value is wrong, and that you are
> matching the Text versus the value. Try manually setting your
> select value:
>
> $default[Area] = "myvalue";
>
> And see if that works.
>
> >-----Original Message-----
> >From: Kilbride, James [mailto:James.Kilbride@gd-ais.com]
> >Sent: Wednesday, October 26, 2005 5:31 AM
> >To: pear-general@lists.php.net
> >Subject: [PEAR] Quick_form Select Defaults
> >
> >I'm trying to set a default for the quick form select type
> and I have
> >the following code:
> >
> >$activityForm->addElement('select','Area','Activity
> >Area:',$areas); //$areas is my array of values and names
> >$defaults['Area']=$default_val; // additional fields created and
> >defaults saved into $defaults $activityForm->setDefaults($defaults);
> >
> >It sets the values of everything except my select statement.
> >I've checked to make sure the $defaults['Area'] is still set
> and it is.
> >Anybody know what I"m missing here? ican't find anything in the
> >quick_form documentation that suggests select is any different from
> >anything else.
> >
> >James Kilbride
> >
>
> --
> PEAR General Mailing List (http://pear.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>