Greetings great sages

I have a question about form action using TT2 and FB.

Here's the details.

I have a an FB-based script using a TT2 template. The template sets the baseurl meta tag and creates the initial form using this instantion of an FB object

85 my $form = CGI::FormBuilder->new( 86 template => { 87 type=> 'TT2', 88 template => 'contact.tt', 89 variable => 'contact' }, 90 name => 'contactform', 91 id => 'contactform', 92 fields => \@formfields , 93 method => 'post', 94 );

If I use this, I get The requested URL /<scriptname> was not found on this server. error message because, upon form post, there is an attempt to load <baseurl>/<scriptname> and not <baseurl>/cgi/<scriptname>

I have also tried

  1. action => '<baseurl>'/cgi/'scriptname' in the script - Result: an HTTP 500 Internal Server Error with the script url still intact
  2. action => './cgi/<scriptname>' - Result: gives some errors in the cgi script and the url still intact
  3. action => './<scriptname>' - Result: the error The requested URL /contact.cgi was not found on this server.
  4. setting the baseurl to '<original baseurl>/cgi/' in the template - Result: promptly lose my stylesheets and other constant site data based on baseurl

Okay, I have to debug my script some, and I will be looking for something to help with automatic form submission and testing.

However, I have found that the form action as in 0 (accept FB's default) and 3 don't give the desired result of form post to the original form url. Method 2 gives the desired result, and I'm still out with the jury on method 1.

I can understand why method 3 fails. The scriptname is concatenated to the baseurl and this appears to be what happens with FB's default too.

I'm using method 2 because it works

I would like to know if there is a way to avoid mentioning the scriptname in the instantion of the FB object when using a directory structure on cgi scripts or would it be better to not have that directory structure? Is this the tradeoff?


In reply to Form action with TT2 and FB v3.03 by LesleyB

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.