[html-formfu] Isn't add_valid() working?

Octavian Rasnita orasnita at gmail.com
Sat Oct 18 21:50:32 BST 2008


Hi,

I've read in the POD docs that:

add_valid
Arguments: $name, $value
Return Value: $value
The provided value replaces any current value for the named field. This 
value will be returned in subsequent calls to
"params" and "param" and the named field will be included in calculations 
for "valid".

I have tried:

if ($form->submitted_and_valid) {
$form->add_valid('field_name', 'trilulilu');
$form->process;
$form->model->update($c->user->obj);
}

But instead of updating the field "field_name" with "trilulilu", it updates 
with the text entered in the form by the user even though the POD says that 
this method replaces the existing value with the specified one.

I have also tried adding before the line with this method:

$form->remove_element($form->get_element({name => 'field_name'}));

But in this case the value of this field remains unchanged at all.

Am I doing something wrong? Please tell me how can I modify the values from 
$form before updating them with
$form->model->update($c->user->obj);

Thank you.

Octavian




More information about the HTML-FormFu mailing list