Re: QF: setDefaults ?
| From: | Justin Patrin | Date: | Sat, 19 Nov 2005 05:04:54 +0000 |
| Subject: | Re: QF: setDefaults ? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22000@lists.php.net to get a copy of this message | ||
On 11/18/05, PitesaJ@peteramayer.com <PitesaJ@peteramayer.com> wrote:
> I have a form with a field for "source". If "JE" is entered I want to
> assign the next numerical JE number to the "source". I am trying the
> following:
>
> $form->setDefaults(array('source' => $source));
>
> $entryElement=&$form->addElement('text', 'source',
> 'Source','onchange="javascript:this.form.submit();"');
>
> With this I am able to assign the "new source, ie JE#10-10" to $source but
> the element "source" still reflects the original value, "JE".
>
> How can I update to reflect the new value?
>
This is because defaults have a lower precedence than submitted
values. Use setConstants with the new value.
--
Justin Patrin