[html-formfu] value not accepted

Mario Minati mario.minati at googlemail.com
Wed Sep 26 15:27:20 GMT 2007


On Wednesday 26 September 2007 12:57:27 Josef Chladek wrote:
> Am 26.09.2007 um 12:45 schrieb Carl Franks:
> > On 26/09/2007, Josef Chladek <josef.chladek at gmail.com> wrote:
> >> hello again,
> >>
> >> in my code:
> >>
> >> my $nick = $c->stash->{form}->get_field('nickname');
> >> $nick->value($c->stash->{form}->param('username')) if length($c-
> >>
> >>> stash->{form}->param('nickname')) == 0;
> >>
> >> $c->stash->{form}->process;
> >> $c->log->debug($c->stash->{form}->get_field('nickname')->value);
> >>
> >> in the debug output I can see that nickname is set to the username,
> >> when the form is rendered, the nickname field stays empty - what am I
> >> doing wrong?
> >
> > For text fields, value() is just an alias to default() - and default
> > is ignored when rendering after a submission.
> >
> > I think either of these solutions should work:
> >
> >     $nick->default( $form->param('username') );
> >     $nick->force_default(1);
> >
> > or
> >
> >     $form->add_valid( 'nickname', $form->param('username') );
> >
> > Carl
>
> the latter I'd tried before (and did not work), the solution with
> force_default did it.

Josef,

could you post the code useing add_valid so we can figure out where the 
problem is.

Thanks,
Mario



More information about the HTML-FormFu mailing list