I kind of figure it out by myself. It seems that I can't return to its
original url with "action" when I use the post method.

Cheers all.


2013/3/21 Logust Yu <logus...@googlemail.com>

> Hello,
>
> I've tried Formbuilder with Apache and had no problem with that. But when
> I use Formbuilder with Dancer, I have to deliberately set a value to
> "action", otherwise it will go to a blank page. But this trick only works
> when the method within the formbuilder section is "get". If I change it to
> "post", it again goes to a blank page.
>
> Is there anything I can do to mend this?
>
> Many thanks!
>
> L
>
> get '/' => sub {
>  my @fields = qw(Username Password);
>
> my $form = CGI::FormBuilder->new(
>  method => 'post',
>  fields => \@fields,
>  action => '/',
>  required => 'ALL',
>  );
> $form->field(name => 'Password',
>  type => 'password',
>  );
>
> if ($form->submitted && $form->validate) {
> # you would write code here to act on the form data
>  my $username = $form->field('Username');
> my $password = $form->field('Password');
>
> .......
> } else {
> return $form->render;
>  }
> };
> dance;
>

Reply via email to