PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm_Livesearch » Bug #8638

Set a default value

Details

Request #8638Set a default value
Submitted2006-09-05 14:16 UTC
Fromjason at greenhell dot com
Assignedthesee
StatusBogus
PackageHTML_QuickForm_Livesearch
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2006-09-05 14:16 UTC] jason at greenhell dot com

Description:
------------
It doesn't seem possible to set a default value on this element.

[2006-09-05 15:31 UTC] thesee at php dot net

Probably you are using a wrong routine. I'm using the set default value in a production environment and it works good.
With a routine similar to this:
$elem = &$form->getElement($key);
$elem->setValue($val);
you can set the default value. Are you using a different routine?
The $val must be (obviously) the id of the element.
Please, take a look at the example files. you can find it in the Livesearch package.
There is a working example with the setValue method.
Let me know.
Bye

[2006-09-05 15:46 UTC] jason at greenhell dot com

I'm looking through the example for setValue().

http://cvs.php.net/viewcvs.cgi/pear/HTML_QuickForm_Livesearch/example/index.php?revision=1.3&view=markup

Here is my routine:

$e = $form->getElement('account_id');
$e->setValue(12);

Which does not seem to be working. I've also tried using $form->setDefaults(array('account_id'=>12));

Thanks!

[2006-09-05 20:40 UTC] thesee at php dot net

Sorry, but your problem does not imply a bug in PEAR itself. For a
list of more appropriate places to ask for help using PEAR, please
visit http://pear.php.net/support/ as this bug system is not the
appropriate forum for asking support questions.

Thank you for your interest in PEAR.

Now, this is a work example:
http://clansworld.fastgaming.it/PEAR/Livesearch/index.php
you can see the source
http://clansworld.fastgaming.it/PEAR/Livesearch/index.phps
http://clansworld.fastgaming.it/PEAR/Livesearch/livesearch.class.phps
http://clansworld.fastgaming.it/PEAR/Livesearch/myfunction.phps

It simple to make mistake writing the main "custom" files as livesearch.class.php and myfunction.php.
So review your code and solve your bug/typos.

If you have any problem about it, plz write to mailing list.
Thank you.
Bye

[2006-12-16 10:53 UTC] thesee at php dot net

Edit to bogus, this were not a bug!