FAQ
Hello everyone,

I have 4 files that I am using to test HTML::FormFu
and I am just "not getting it".

This is the sequence of events:

The user+browser calls http://localhost/cgi-bin/simple.cgi
simple.cgi gets called and the form shows up on the browser.
The user fills in the single field.
The CGI script that is supposed to do the form processing:
"simple_get.cgi"
gets called but cannot return a positive from:
$form->submitted;

I have included all 4 files.

I figure this is the simplest, complete, example of using HTML::FormFu.

What am I doing wrong?

Any help would be appreciated as I am going nuts over
this.

Many Thanks in Advance,

George
======================

The relevant files:
First, the yml file: simple.yml
======================
---
auto_fieldset: 1
elements:
- type: Text
name: textvar
...
======================

Next, the HTML file: simple.shtml
======================
<HTML>
<HEAD>
<TITLE>Test Template</TITLE>
</HEAD>
<BODY>
Form:
<p>
<TMPL_VAR NAME="form">
</p>
<BR>
</BODY>
</HTML>
======================

Next, the initial CGI file: simple.cgi
======================
1 #!/usr/bin/perl
2 #
3 # @(#)
4 #
5 use strict;
6 use warnings;
7 use HTML::FormFu;
8 use YAML::Syck qw( Load );
9 use CGI qw(:standard);
10 use HTML::Template;
11
12 use vars qw ($cgi_query $template $form $formret $TimeFormat);
13 use vars qw ($RstrLdate $RstrLtime);
14 #
15 #
16 my($query, $template, $formret);
17 my($template_out);
18
19 $query = new CGI;
20 print $query->header();
21
22 #
23 # open the HTML template
24 $form = HTML::FormFu->new;
25 $form->load_config_file('/opt/http/forms/simple.yml');
26 $form->action("/cgi-bin/simple_get.cgi");
27 $form->method("post");
28 $form->indicator("textvar");
29 $form->process( $cgi_query );
30
31 $template = HTML::Template->new(filename => '/opt/http/templates/simple.shtml');
32
33 # fill in some parameters in the template
34 if ( $form->submitted ) {
35 `/bin/echo "proc: submittted" >>/tmp/http.log`;
36 } else {
37 `/bin/echo "proc: Not-submittted" >>/tmp/http.log`;
38 #
39 # Show form to user via apache
40 $template->param( form => $form );
41 $template_out = $template->output;
42 print $template_out . "\n";
43 }
======================

And last, the processing CGI file: simple_get.cgi
======================
1 #!/usr/bin/perl
2 #
3 # @(#)
4 #
5 use strict;
6 use warnings;
7 use HTML::FormFu;
8 use YAML::Syck qw( Load );
9 use CGI qw(:standard);
10 use HTML::Template;
11
12 use vars qw ($cgi_query $template $form $formret $TimeFormat);
13 use vars qw ($RstrLdate $RstrLtime);
14 #
15 #
16 my($query, $template, $formret);
17 my($template_out);
18
19 $query = new CGI;
20 print $query->header();
21 #
22 # open the HTML template
23 $form = HTML::FormFu->new;
24 $form->load_config_file('/opt/http/forms/simple.yml');
25 #$form->action("/cgi-bin/simple_get.cgi");
26 #$form->method("post");
27 $form->indicator("submit");
28 $form->process();
29
30 $template = HTML::Template->new(filename => '/opt/http/templates/simple.shtml');
31
32 # fill in some parameters in the template
33 if ( $form->submitted ) {
34 `/bin/echo "proc: submittted" >>/tmp/http.log`; # We never get here!!!
35 } else {
36 `/bin/echo "proc: Not-submittted" >>/tmp/http.log`;
37 $template->param( form => $form );
38 $template_out = $template->output;
39 print $template_out . "\n";
40 }
======================

Search Discussions

  • Carl Franks at May 25, 2011 at 7:04 am

    First, the yml file: simple.yml
    ======================
    ---
    ? ?auto_fieldset: 1
    ? ?elements:
    ? ? ? ?- type: Text
    ? ? ? ? ?name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    ?27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl
  • George Hrysanthopoulos at May 25, 2011 at 7:16 am
    Carl,

    You are quite right. However, even when I did:

    27 $form->indicator("textvar");

    I still got same result. Actually I had a button there
    called: "submit" but I removed it for the sake
    of simplicity.

    How is my overall logic?

    -George
    On 5/25/11 3:04 AM, Carl Franks wrote:
    First, the yml file: simple.yml
    ======================
    ---
    auto_fieldset: 1
    elements:
    - type: Text
    name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • George Hrysanthopoulos at May 25, 2011 at 7:18 am
    Carl,

    You are quite right. However, even when I did:

    27 $form->indicator("textvar");

    I still got same result. Actually I had a button there
    called: "submit" but I removed it for the sake
    of simplicity.

    How is my overall logic?

    -George
    On 5/25/11 3:04 AM, Carl Franks wrote:
    First, the yml file: simple.yml
    ======================
    ---
    auto_fieldset: 1
    elements:
    - type: Text
    name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Carl Franks at May 25, 2011 at 7:27 am
    Ah, yes -in the cgi handling the submission, process() needs to be passed
    the $query object
    On 25 May 2011 08:19, "George Hrysanthopoulos" wrote:
    Carl,

    You are quite right. However, even when I did:

    27 $form->indicator("textvar");

    I still got same result. Actually I had a button there
    called: "submit" but I removed it for the sake
    of simplicity.

    How is my overall logic?

    -George
    On 5/25/11 3:04 AM, Carl Franks wrote:
    First, the yml file: simple.yml
    ======================
    ---
    auto_fieldset: 1
    elements:
    - type: Text
    name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110525/90a1ddf8/attachment.htm
  • George Hrysanthopoulos at May 25, 2011 at 7:41 am
    Ok, what would be an example of a "$query object".

    I know, I know, but Google is not helping me!

    George
    On 5/25/11 3:27 AM, Carl Franks wrote:

    Ah, yes -in the cgi handling the submission, process() needs to be passed the $query object
    On 25 May 2011 08:19, "George Hrysanthopoulos" wrote:
    Carl,

    You are quite right. However, even when I did:

    27 $form->indicator("textvar");

    I still got same result. Actually I had a button there
    called: "submit" but I removed it for the sake
    of simplicity.

    How is my overall logic?

    -George
    On 5/25/11 3:04 AM, Carl Franks wrote:
    First, the yml file: simple.yml
    ======================
    ---
    auto_fieldset: 1
    elements:
    - type: Text
    name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk >> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110525/0584960f/attachment-0001.htm
  • George Hrysanthopoulos at May 25, 2011 at 8:39 am
    Ok, problem solved! Phew!

    I will post all the files in downloadable form
    at "http://www.xm5design.com/" sometime tomorrow.
    After I wake up!

    Thanks Carl! You have made my day(night).

    Now, I can go to sleep!

    George

    Solution: The "simple_get.cgi" script must look like this:
    ===============================
    1 #!/usr/bin/perl
    2 #
    3 # @(#)
    4 #
    5 use strict;
    6 use warnings;
    7 use HTML::FormFu;
    8 use YAML::Syck qw( Load );
    9 use CGI qw(:standard);
    10 use HTML::Template;
    11
    12 use vars qw ($cgi_query $template $form $formret $TimeFormat);
    13 use vars qw ($RstrLdate $RstrLtime);
    14 #
    15 #
    16 my($query, $template, $formret);
    17 my($template_out, $CGI_query);
    18
    19 #
    20 # Note: When calling "new CGI" the variables (as passed by apache) will fill in the
    21 # query and each variable can be accessed via: $form->param_value('variable_name_in_form')
    22 $CGI_query = new CGI;
    23 print $CGI_query->header();
    24 #
    25 # open the HTML template
    26 $form = HTML::FormFu->new;
    27 $form->load_config_file('/opt/http/forms/simple.yml');
    28 $form->action("/cgi-bin/simple_get.cgi");
    29 $form->method("post");
    30 $form->indicator("textvar");
    31 $form->query( $CGI_query ) ;
    32 $form->process();
    33
    34 $template = HTML::Template->new(filename => '/opt/http/templates/simple.shtml');
    35 #
    36 # fill in some parameters in the template
    37 if ( $form->submitted ) {
    38 `/bin/echo "proc: submittted" >>/tmp/http.log`;
    39 #
    40 $template->param( form => $form->param_value('textvar') );
    41 $template_out = $template->output;
    42 print $template_out . "\n";
    43 } else {
    44 `/bin/echo "proc: Not-submittted" >>/tmp/http.log`;
    45 $template->param( form => $form );
    46 $template_out = $template->output;
    47 print $template_out . "\n";
    48 }
    ===================================
    On 5/25/11 3:41 AM, George Hrysanthopoulos wrote:
    Ok, what would be an example of a "$query object".

    I know, I know, but Google is not helping me!

    George
    On 5/25/11 3:27 AM, Carl Franks wrote:

    Ah, yes -in the cgi handling the submission, process() needs to be passed the $query object
    On 25 May 2011 08:19, "George Hrysanthopoulos" wrote:
    Carl,

    You are quite right. However, even when I did:

    27 $form->indicator("textvar");

    I still got same result. Actually I had a button there
    called: "submit" but I removed it for the sake
    of simplicity.

    How is my overall logic?

    -George
    On 5/25/11 3:04 AM, Carl Franks wrote:
    First, the yml file: simple.yml
    ======================
    ---
    auto_fieldset: 1
    elements:
    - type: Text
    name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk > >> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk > > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110525/17b27582/attachment.htm
  • George Hrysanthopoulos at May 25, 2011 at 7:23 am
    When I do:

    On line 34 of "simple_get.cgi"
    34 if( $query->param("textvar") ) {
    35 `/bin/echo "proc: submittted" >>/tmp/http.log`;

    Instead of:

    34 if ( $form->submitted ) {
    35 `/bin/echo "proc: submittted" >>/tmp/http.log`; # We never get here!!!

    The "if" condition is true!

    -George

    On 5/25/11 3:04 AM, Carl Franks wrote:
    First, the yml file: simple.yml
    ======================
    ---
    auto_fieldset: 1
    elements:
    - type: Text
    name: textvar
    And last, the processing CGI file: simple_get.cgi
    ======================
    27 $form->indicator("submit");
    indicator('submit') tells process() that a form must have a value for
    the field 'submit'.
    Your form config doesn't have a 'submit' field/button.
    So $form->submitted() will always be false.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Carl Franks at May 25, 2011 at 8:34 am
    Personally, for a simple example, I'd combine the 2 .cgi files into 1.
    your simple.cgi is already doing `if ( $form->submitted ) {} else {}`
    so the form may as well post to simple.cgi, and you can just get rid
    of the 2nd .cgi
    Next, ?the initial CGI file: simple.cgi
    ======================
    ?28 $form->indicator("textvar");
    ?29 $form->process( $cgi_query );
    As it is, lines 28 is redundant, and line 29 doesn't need the
    $cgi_query parameter passed, as that .cgi is only being used to
    display the form.
    And last, the processing CGI file: simple_get.cgi
    ======================
    ?19 $query = new CGI;
    ?25 #$form->action("/cgi-bin/simple_get.cgi");
    ?26 #$form->method("post");
    ?27 $form->indicator("submit");
    ?28 $form->process();
    Line 28 needs to be
    $form->process( $query );
    This will solve the initial problem.

    Carl
  • George Hrysanthopoulos at May 25, 2011 at 8:47 am
    Carl,

    The reason I created 2 separate .cgi is to illustrate the possibility
    of doing just that.

    In real life, I might use a single .cgi (or not) depending on complexity.

    You have been a great help and I very much appreciate your time.

    George
    On 5/25/11 4:34 AM, Carl Franks wrote:
    Personally, for a simple example, I'd combine the 2 .cgi files into 1.
    your simple.cgi is already doing `if ( $form->submitted ) {} else {}`
    so the form may as well post to simple.cgi, and you can just get rid
    of the 2nd .cgi
    Next, the initial CGI file: simple.cgi
    ======================
    28 $form->indicator("textvar");
    29 $form->process( $cgi_query );
    As it is, lines 28 is redundant, and line 29 doesn't need the
    $cgi_query parameter passed, as that .cgi is only being used to
    display the form.
    And last, the processing CGI file: simple_get.cgi
    ======================
    19 $query = new CGI;
    25 #$form->action("/cgi-bin/simple_get.cgi");
    26 #$form->method("post");
    27 $form->indicator("submit");
    28 $form->process();
    Line 28 needs to be
    $form->process( $query );
    This will solve the initial problem.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Peter Shangov at May 25, 2011 at 9:19 am
    Hi George,

    You can also have a look at HTML::FormFu::Manual on CPAN.

    Cheers,

    --
    Peter

    --- On Wed, 25/5/11, George Hrysanthopoulos wrote:
    From: George Hrysanthopoulos <xaos@darksmile.net>
    Subject: Re: [html-formfu] New user with simple question
    To: "HTML Form Creation, Rendering and Validation Framework" <html-formfu@lists.scsys.co.uk>
    Date: Wednesday, 25 May, 2011, 11:47
    Carl,

    The reason I created 2 separate .cgi is to illustrate the
    possibility
    of doing just that.

    In real life, I might use a single .cgi (or not) depending
    on complexity.

    You have been a great help and I very much appreciate your
    time.

    George
    On 5/25/11 4:34 AM, Carl Franks wrote:
    Personally, for a simple example, I'd combine the 2
    .cgi files into 1.
    your simple.cgi is already doing `if (
    $form->submitted ) {} else {}`
    so the form may as well post to simple.cgi, and you
    can just get rid
    of the 2nd .cgi
    Next,? the initial CGI file: simple.cgi
    ======================
    ???28
    $form->indicator("textvar");
    ???29 $form->process( $cgi_query
    );
    As it is, lines 28 is redundant, and line 29 doesn't need the
    $cgi_query parameter passed, as that .cgi is only
    being used to
    display the form.
    And last, the processing CGI file: simple_get.cgi
    ======================
    ???19 $query = new CGI;
    ???25
    #$form->action("/cgi-bin/simple_get.cgi");
    ???26 #$form->method("post");
    ???27
    $form->indicator("submit");
    ???28 $form->process();
    Line 28 needs to be
    ? ? ? $form->process( $query );
    This will solve the initial problem.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • George Hrysanthopoulos at May 25, 2011 at 7:43 pm
    Peter,

    Carl's one hint at the issue, was more enlightening that
    the entire CPAN site put together. I am not even
    slightly kidding.

    Why hasn't anyone posted a simple scenario (such as mine)
    to CPAN, as a starting point to HTML::FormFu programming?

    I am talking about a complete set of files not code snippets.

    Like I said, I will post all 4 of my files (with explanations) on my site:
    www.xm5design.com.

    Hopefully, a new user won't spend a few days (just like I did)
    decoding the (not very) helpful manual.

    At least not to beginners and I consider myself an advanced perl user.

    Sorry if I am stepping on anyone's toes here but it seems to me
    that a tool, such as HTML::FormFu, should have a myriad of
    examples. There is so much power there.

    George
    On 5/25/11 5:19 AM, Peter Shangov wrote:
    Hi George,

    You can also have a look at HTML::FormFu::Manual on CPAN.

    Cheers,

    --
    Peter

    --- On Wed, 25/5/11, George Hrysanthopouloswrote:
    From: George Hrysanthopoulos<xaos@darksmile.net>
    Subject: Re: [html-formfu] New user with simple question
    To: "HTML Form Creation, Rendering and Validation Framework"<html-formfu@lists.scsys.co.uk>
    Date: Wednesday, 25 May, 2011, 11:47
    Carl,

    The reason I created 2 separate .cgi is to illustrate the
    possibility
    of doing just that.

    In real life, I might use a single .cgi (or not) depending
    on complexity.

    You have been a great help and I very much appreciate your
    time.

    George
    On 5/25/11 4:34 AM, Carl Franks wrote:
    Personally, for a simple example, I'd combine the 2
    .cgi files into 1.
    your simple.cgi is already doing `if (
    $form->submitted ) {} else {}`
    so the form may as well post to simple.cgi, and you
    can just get rid
    of the 2nd .cgi
    Next, the initial CGI file: simple.cgi
    ======================
    28
    $form->indicator("textvar");
    29 $form->process( $cgi_query
    );
    As it is, lines 28 is redundant, and line 29 doesn't need the
    $cgi_query parameter passed, as that .cgi is only
    being used to
    display the form.
    And last, the processing CGI file: simple_get.cgi
    ======================
    19 $query = new CGI;
    25
    #$form->action("/cgi-bin/simple_get.cgi");
    26 #$form->method("post");
    27
    $form->indicator("submit");
    28 $form->process();
    Line 28 needs to be
    $form->process( $query );
    This will solve the initial problem.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Peter Shangov at May 26, 2011 at 8:57 am
    Re-posting to the mailing list as well.

    --- On Thu, 26/5/11, Peter Shangov wrote:
    From: Peter Shangov <pshangov@yahoo.com>
    Subject: Re: [html-formfu] New user with simple question
    To: "George Hrysanthopoulos" <xaos@darksmile.net>
    Date: Thursday, 26 May, 2011, 11:51
    Hi George,

    The examples of the topics that you discussed should be in
    the following two chapters of the manual:

    http://search.cpan.org/perldoc?HTML::FormFu::Manual::Stages
    http://search.cpan.org/perldoc?HTML::FormFu::Manual::ConfigurationFiles

    Can you point at specific topics or examples that you think
    are missing or are not clear enough, so that I can have an
    idea what else to include there? The manual is particularly
    geared towards people who are new to FormFu, so I's love to
    get some feedback.

    Cheers,

    --
    Peter

    --- On Wed, 25/5/11, George Hrysanthopoulos wrote:
    From: George Hrysanthopoulos <xaos@darksmile.net>
    Subject: Re: [html-formfu] New user with simple question
    To: "HTML Form Creation, Rendering and Validation
    Framework" <html-formfu@lists.scsys.co.uk>
    Cc: "Peter Shangov" <pshangov@yahoo.com>
    Date: Wednesday, 25 May, 2011, 22:43
    Peter,

    Carl's one hint at the issue, was more enlightening that
    the entire CPAN site put together. I am not even
    slightly kidding.

    Why hasn't anyone posted a simple scenario (such as mine)
    to CPAN, as a starting point to HTML::FormFu
    programming?
    I am talking about a complete set of files not code
    snippets.

    Like I said, I will post all 4 of my files (with
    explanations) on my site:
    www.xm5design.com.

    Hopefully, a new user won't spend a few days (just like I
    did)
    decoding the (not very) helpful manual.

    At least not to beginners and I consider myself an advanced
    perl user.

    Sorry if I am stepping on anyone's toes here but it seems
    to me
    that a tool, such as HTML::FormFu, should have a myriad of
    examples. There is so much power there.

    George
    On 5/25/11 5:19 AM, Peter Shangov wrote:
    Hi George,

    You can also have a look at HTML::FormFu::Manual
    on
    CPAN.
    Cheers,

    --
    Peter

    --- On Wed, 25/5/11, George Hrysanthopoulos<xaos@darksmile.net>?
    wrote:
    From: George Hrysanthopoulos<xaos@darksmile.net>
    Subject: Re: [html-formfu] New user with
    simple
    question
    To: "HTML Form Creation, Rendering and
    Validation
    Framework"<html-formfu@lists.scsys.co.uk>
    Date: Wednesday, 25 May, 2011, 11:47
    Carl,

    The reason I created 2 separate .cgi is to
    illustrate the
    possibility
    of doing just that.

    In real life, I might use a single .cgi (or
    not)
    depending
    on complexity.

    You have been a great help and I very much
    appreciate your
    time.

    George
    On 5/25/11 4:34 AM, Carl Franks wrote:
    Personally, for a simple example, I'd
    combine
    the 2
    .cgi files into 1.
    your simple.cgi is already doing `if (
    $form->submitted ) {} else {}`
    so the form may as well post to
    simple.cgi,
    and you
    can just get rid
    of the 2nd .cgi
    Next,? the initial CGI file:
    simple.cgi
    ======================
    ? ???28
    $form->indicator("textvar");
    ? ???29
    $form->process( $cgi_query
    );
    As it is, lines 28 is redundant, and line
    29
    doesn't
    need the
    $cgi_query parameter passed, as that .cgi
    is
    only
    being used to
    display the form.
    And last, the processing CGI file:
    simple_get.cgi
    ======================
    ? ???19 $query = new
    CGI;
    ? ???25
    #$form->action("/cgi-bin/simple_get.cgi");
    ? ???26
    #$form->method("post");
    ? ???27
    $form->indicator("submit");
    ? ???28
    $form->process();
    Line 28 needs to be
    ? ? ? ? $form->process(
    $query );
    This will solve the initial problem.

    Carl
    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • George Hrysanthopoulos at May 30, 2011 at 12:21 am
    On 5/26/11 4:50 PM, George Hrysanthopoulos wrote:
    Peter,

    The two links you supplied have been of great use to me.
    Thank you for taking the time to create them.

    If my email seemed a bit heavy on criticism, please
    accept my apologies. There is no room for critics
    in an open source project. Only contributors.

    So, in that regard:

    As a newbie to FormFu, I was expecting a HOWTO
    like this:

    1. Get your Apache server running.
    2. Install FormFu
    3. Create these (x number) of files.
    4. Run the example.

    The examples in the documentation go into great
    detail on how to give parameters to FormFu
    but are missing some serious details.

    For example, it is clear that (from the script
    that processes the form), after the user hits "submit",
    that the proper sequence of events is:

    #!/usr/bin/perl
    #
    # @(#)
    #
    use strict;
    use warnings;
    use HTML::FormFu;
    use YAML::XS qw( Load );
    use CGI qw(:standard);
    use HTML::Template;

    use vars qw ($template $form $formret);
    my($CGI_query, $template, $formret);

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

    $form = HTML::FormFu->new;
    $form->load_config_file('config.yml');
    $form->indicator("submit_button");
    $form->query( $CGI_query ) ;
    $form->process();

    if ( $form->submitted ) {
    #
    # Now process that data as filled in by the user
    #...
    }

    None of the documentation mentions CGI and proper calling
    sequence.

    When Carl gave me a hint I knew immediately what to do.
    But this is after scratching my head for two days.

    This is what I meant but not having enough docs.

    I am more than happy to submit the 4 files (of my very simple
    form and associated CGI/template files), for everyone to
    use. It is a complete project.

    -George

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedMay 25, '11 at 6:38a
activeMay 30, '11 at 12:21a
posts14
users3
websitemetacpan.org...

People

Translate

site design / logo © 2022 Grokbase