the form-name is only used for the name of the form, not as an prefix for the name of the fields inside the form

I see, a misunderstanding. Documentation shows

<tr id="${form}_${field}_row"> <td id="${form}_${field}_label">Label</td> <td id="${form}_${field}_input"><input tag></td> <td id="${form}_${field}_error">Error</td><!-- if invalid +--> </tr>
And that matches my experience (s/_input/_field/), this code
#!/usr/bin/perl -- use strict; use warnings; use CGI::FormBuilder; my $form = CGI::FormBuilder->new( name => 'acctinfo'); $form->field(name => 'fname', label => 'First Name'); $form->field(name => 'lname', label => 'Last Name'); print $form->render(header => 1);
produces this html
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_U +S"> <head> <title> </title> </head> <body bgcolor="white"> <h3> </h3> <!-- Generated by CGI::FormBuilder v3.0501 available from www.formbuil +der.org --> <form action="-" id="acctinfo" method="get" name="acctinfo"> <div id="acctinfo_state"><input id="_submitted_acctinfo" name="_submit +ted_acctinfo" type="hidden" value="1" /></div> <table id="acctinfo_body"> <tr id="acctinfo_fname_row" valign="top"> <td id="acctinfo_fname_label">First Name</td> <td id="acctinfo_fname_field"><input id="fname" name="fname" type="t +ext" /></td> </tr> <tr id="acctinfo_lname_row" valign="top"> <td id="acctinfo_lname_label">Last Name</td> <td id="acctinfo_lname_field"><input id="lname" name="lname" type="t +ext" /></td> </tr> <tr id="acctinfo_submit_row" valign="top"> <td align="center" colspan="2" id="acctinfo_submit_field"><input id= +"acctinfo_submit" name="_submit" type="submit" value="Submit" /></td> </tr> </table> </form> </body> </html>
It seems you want
#!/usr/bin/perl -- use strict; use warnings; use CGI::FormBuilder; my $form = CGI::FormBuilder->new( name => 'acctinfo'); $form->field(name => 'acctinfo_fname', label => 'First Name'); $form->field(name => 'acctinfo_lname', label => 'Last Name'); print $form->render(header => 1);

In reply to Re^3: Formbuilder: generate id, that includes formname by Anonymous Monk
in thread Formbuilder: generate id, that includes formname by Wolfgang

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.