FAQ
I'm using Test::WWW::Mechanize::Catalyst to test my Catalyst App, more
specifically the process for registering new user accounts.

The application form is generated by Catalyst::Controller::HTML::FormFu
with the expected fields: username, password, confirm_password, email
and the submit => 'Register' button (indicator).

When using the good ol' browser the form is submitted and an email sent
for validation, no problem.

However, making the exact same call with Test::WWW::Mechanize::Catalyst
as follows:

my $fields = {
username => $username,
password => $password,
confirm_password => $password,
password_hint => $password_hint,
email => $email,
submit => 'Register'
};

$mech->submit_form(
form_number => 0,
fields => $fields,
);

will not work because within the sub register : Global FormConfig of my
controller, $form->submitted_and_valid is returning false for some weird
reason.

I tried debugging the HTML::FormFu stuff but this is all very
complicated.

Can anyone help me here?

--
Kiffin Gish <Kiffin.Gish@planet.nl>
Gouda, The Netherlands

Search Discussions

  • Ash Berlin at Jun 22, 2009 at 8:50 pm

    On 22 Jun 2009, at 19:50, Kiffin Gish wrote:

    I'm using Test::WWW::Mechanize::Catalyst to test my Catalyst App, more
    specifically the process for registering new user accounts.

    The application form is generated by
    Catalyst::Controller::HTML::FormFu
    with the expected fields: username, password, confirm_password, email
    and the submit => 'Register' button (indicator).

    When using the good ol' browser the form is submitted and an email
    sent
    for validation, no problem.

    However, making the exact same call with
    Test::WWW::Mechanize::Catalyst
    as follows:

    my $fields = {
    username => $username,
    password => $password,
    confirm_password => $password,
    password_hint => $password_hint,
    email => $email,
    submit => 'Register'
    };

    $mech->submit_form(
    form_number => 0,
    fields => $fields,
    );

    will not work because within the sub register : Global FormConfig of
    my
    controller, $form->submitted_and_valid is returning false for some
    weird
    reason.

    I tried debugging the HTML::FormFu stuff but this is all very
    complicated.

    Can anyone help me here?
    I'm guessing HTML::FormFu determines that the form is submitted by the
    value of the input from the submit button (rather that it just being a
    post request which is my personal preference)

    To get WWW::Mechanize to send this value do, call


    $mech->submit_form(
    with_fields => $fields,
    button => 'submit' # or what ever the name attr of the submit
    button is.
    );
  • Kiffin Gish at Jun 23, 2009 at 11:05 am

    On Mon, 2009-06-22 at 21:50 +0100, Ash Berlin wrote:
    On 22 Jun 2009, at 19:50, Kiffin Gish wrote:

    I'm using Test::WWW::Mechanize::Catalyst to test my Catalyst App, more
    specifically the process for registering new user accounts.

    The application form is generated by
    Catalyst::Controller::HTML::FormFu
    with the expected fields: username, password, confirm_password, email
    and the submit => 'Register' button (indicator).

    When using the good ol' browser the form is submitted and an email
    sent
    for validation, no problem.

    However, making the exact same call with
    Test::WWW::Mechanize::Catalyst
    as follows:

    my $fields = {
    username => $username,
    password => $password,
    confirm_password => $password,
    password_hint => $password_hint,
    email => $email,
    submit => 'Register'
    };

    $mech->submit_form(
    form_number => 0,
    fields => $fields,
    );

    will not work because within the sub register : Global FormConfig of
    my
    controller, $form->submitted_and_valid is returning false for some
    weird
    reason.

    I tried debugging the HTML::FormFu stuff but this is all very
    complicated.

    Can anyone help me here?
    I'm guessing HTML::FormFu determines that the form is submitted by the
    value of the input from the submit button (rather that it just being a
    post request which is my personal preference)

    To get WWW::Mechanize to send this value do, call


    $mech->submit_form(
    with_fields => $fields,
    button => 'submit' # or what ever the name attr of the submit
    button is.
    );
    This didn't help me, any other ideas?

    How can use the value returned by $form->has_errors() or something
    similar and log the errors for trouble-shooting?
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    --
    Kiffin Gish <Kiffin.Gish@planet.nl>
    Gouda, The Netherlands
  • Kiffin Gish at Jun 23, 2009 at 12:28 pm

    On Tue, 2009-06-23 at 13:05 +0200, Kiffin Gish wrote:
    On Mon, 2009-06-22 at 21:50 +0100, Ash Berlin wrote:
    On 22 Jun 2009, at 19:50, Kiffin Gish wrote:

    I'm using Test::WWW::Mechanize::Catalyst to test my Catalyst App, more
    specifically the process for registering new user accounts.

    The application form is generated by
    Catalyst::Controller::HTML::FormFu
    with the expected fields: username, password, confirm_password, email
    and the submit => 'Register' button (indicator).

    When using the good ol' browser the form is submitted and an email
    sent
    for validation, no problem.

    However, making the exact same call with
    Test::WWW::Mechanize::Catalyst
    as follows:

    my $fields = {
    username => $username,
    password => $password,
    confirm_password => $password,
    password_hint => $password_hint,
    email => $email,
    submit => 'Register'
    };

    $mech->submit_form(
    form_number => 0,
    fields => $fields,
    );

    will not work because within the sub register : Global FormConfig of
    my
    controller, $form->submitted_and_valid is returning false for some
    weird
    reason.

    I tried debugging the HTML::FormFu stuff but this is all very
    complicated.

    Can anyone help me here?
    I'm guessing HTML::FormFu determines that the form is submitted by the
    value of the input from the submit button (rather that it just being a
    post request which is my personal preference)

    To get WWW::Mechanize to send this value do, call


    $mech->submit_form(
    with_fields => $fields,
    button => 'submit' # or what ever the name attr of the submit
    button is.
    );
    This didn't help me, any other ideas?

    How can use the value returned by $form->has_errors() or something
    similar and log the errors for trouble-shooting?
    Hold, it DID work after all (slight over-site on my part). Thanks alot
    for the tip!
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    --
    Kiffin Gish <Kiffin.Gish@planet.nl>
    Gouda, The Netherlands

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJun 22, '09 at 6:50p
activeJun 23, '09 at 12:28p
posts4
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Kiffin Gish: 3 posts Ash Berlin: 1 post

People

Translate

site design / logo © 2022 Grokbase