[html-formfu] A simple form being troublesome

xaos at darksmile.net xaos at darksmile.net
Tue Jun 7 07:58:46 GMT 2011


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=dddd
         0x02a0:  2670 6173 7377 6f72 643d 6464 6464 6464  &password=dddddd
         0x02b0:  6464 6464 6464 2673 7562 6d69 742e 783d  dddddd&submit.x=
         0x02c0:  3237 2673 7562 6d69 742e 793d 3131 2673  27&submit.y=11&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




More information about the HTML-FormFu mailing list