FAQ
Hello everyone,

I have this simple form (YML):

#
# @(#) Login template
#
---
auto_id: '%n'
auto_constraint_class: '%t'
#
#indicator is the field that is used to test for form submission
auto_fieldset:
legend: "Login"
#
# Start listing the form elements
elements:
- type: Text
name: username
label: "User ID"
- type: Password
name: password
label: Password
#
# Now add a nice button for the "submit action"
- type: Image
name: submit
value: submit
src: "/images/login/green_signon_button_not_pushed.gif"
id: "form_submit_button_label"
attrs:
height: "23"
width: "64"
border: "0"
...

And it generates this HTML:

1 <form action="/cgi-bin/login/login_get.cgi" method="post">
2 <fieldset>
3 <legend>Login</legend>
4
5 <div class="text label">
6 <label>User ID</label> <input name="username" type="text">
7 </div>
8
9 <div class="password label">
10 <label>Password</label> <input name="password"
type="password">
11 </div>
12
13 <div class="image">
14 <input name="submit" type="image" value="submit"
border="0" height="23" id="form_submit_button_label"
src="/images/login/green_signon_button_not_pushed.gif" width="64">
15 </div>
16 </fieldset>
17 </form>
18

And I try to read like this:


$CGI_query = new CGI;
print $CGI_query->header();

$form = HTML::FormFu->new;
$form->load_config_file('/opt/http/htdocs/forms/login/login.yml');
$form->indicator("submit");
$form->query( $CGI_query ) ;
$form->process();
my $pdata = $CGI_query->param('POSTDATA');
if( $pdata ) {
`/bin/echo "Raw: $pdata" >>/tmp/http.log`;
} else {
`/bin/echo "We got no data from post." >>/tmp/http.log`;
}
#
#
my $error = $CGI_query->cgi_error;
if ($error) {
`/bin/echo "$CGI_query->header(-status=>$error),
$CGI_query->start_html('Problems'),
$CGI_query->h2('Request not processed'),
$CGI_query->strong($error)" >>/tmp/http.log`;
}


if ( $form->submitted ) {

###########
I never get here. In other words, I always get "data not submitted"

tcpdump shows:

0x0290: 0a0d 0a75 7365 726e 616d 653d 6464 6464 ...usernameÝdd
0x02a0: 2670 6173 7377 6f72 643d 6464 6464 6464 &passwordÝdddd
0x02b0: 6464 6464 6464 2673 7562 6d69 742e 783d dddddd&submit.x 0x02c0: 3237 2673 7562 6d69 742e 793d 3131 2673 27&submit.y&s
0x02d0: 7562 6d69 743d 7375 626d 6974 ubmit=submit


Any ideas why I don't get the data even though it is definitely sent?

-George

Search Discussions

  • Charlie Garrison at Jun 7, 2011 at 10:13 am
    Good evening,
    On 7/06/11 at 1:58 AM -0600, xaos@darksmile.net wrote:

    0x02b0: 6464 6464 6464 2673 7562 6d69 742e 783d dddddd&submit.x>0x02c0: 3237 2673 7562 6d69 742e 793d 3131 2673 27&submit.y&s
    0x02d0: 7562 6d69 743d 7375 626d 6974 ubmit=submit


    Any ideas why I don't get the data even though it is definitely sent?
    At a guess, the form 'indicator' is not true. I can't see where
    'indicator' is set in yoru code, but I'm guessing the form is
    looking at 'submit' element to determine if $form->submitted is
    true. But the form is sending 'submit.x' (& submit.y).

    Try changing indicator so any element can be used to make
    $form->submitted true. I can't recall specifics so check the
    doco. You may be able to set indicator to 'submit.x' as another option.


    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt
  • Xaos at Jun 7, 2011 at 5:00 pm
    Charlie,

    Using the form below, and doing:

    $form->indicator("submit.x");

    Worked.

    Note the proper placement of the parameters in the
    Image element and the absence of the "value:" keyword.

    Thank you!

    Here is the form:
    ----------------------------------------------
    #
    # @(#) Login template
    #
    ---
    auto_id: '%n'
    auto_constraint_class: '%t'
    #
    auto_fieldset:
    legend: "Login"
    #
    # Start listing the form elements
    elements:
    - type: Text
    name: username
    label: "User ID"
    - type: Password
    name: password
    label: Password
    #
    # Now add a nice button for the "submit action"
    - type: Image
    name: submit
    src: "/images/login/green_signon_button_not_pushed.gif"
    attrs:
    height: "23"
    width: "64"
    border: "0"
    id: "form_submit_button_label"
    ...
    -------------------------------------------------
    Quoting Charlie Garrison <garrison@zeta.org.au>:
    Good evening,
    On 7/06/11 at 1:58 AM -0600, xaos@darksmile.net wrote:

    0x02b0: 6464 6464 6464 2673 7562 6d69 742e 783d dddddd&submit.x>> 0x02c0: 3237 2673 7562 6d69 742e 793d 3131 2673 27&submit.y&s
    0x02d0: 7562 6d69 743d 7375 626d 6974 ubmit=submit


    Any ideas why I don't get the data even though it is definitely sent?
    At a guess, the form 'indicator' is not true. I can't see where
    'indicator' is set in yoru code, but I'm guessing the form is looking
    at 'submit' element to determine if $form->submitted is true. But the
    form is sending 'submit.x' (& submit.y).

    Try changing indicator so any element can be used to make
    $form->submitted true. I can't recall specifics so check the doco. You
    may be able to set indicator to 'submit.x' as another option.


    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt


    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Christian Huldt at Jun 7, 2011 at 11:49 am

    my $pdata = $CGI_query->param('POSTDATA');
    if( $pdata ) {
    `/bin/echo "Raw: $pdata" >>/tmp/http.log`;
    } else {
    `/bin/echo "We got no data from post." >>/tmp/http.log`;
    }
    #
    Do you get anything from POSTDATA in your log?

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedJun 7, '11 at 7:58a
activeJun 7, '11 at 5:00p
posts4
users3
websitemetacpan.org...

People

Translate

site design / logo © 2022 Grokbase