Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2011 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/979927 to your computer and use it in GitHub Desktop.
Save anonymous/979927 to your computer and use it in GitHub Desktop.
toHtml method from WebGUI::FormBuilder
my $f= WebGUI::FormBuilder->new($session);
#for testing, set passed argumentsd
$args->{webgui_id}='123456789.123456789.12';
$args->{product_webgui_id}='456789.123456789.12123';
$args->{needle_length}=>' 3 inches' ;
$f->addField("hidden", name=>"webgui_id", value => $args->{webgui_id});
$f->addField("hidden", name=>"product_webgui_id", value => $args->{product_webgui_id});
$f->addField("Text",
name => "needle_length",
value => $args->{needle_length},
label => 'Needle length',
hooverHelp => 'How long is that needle?',
);
$f->addField("Integer",
name => 'gauge',
value => 55,
label => 'Gauge',
);
$f->addField("Integer",
name => 'outer_diameter',
value => 66,
label => 'Outer Diameter',
);
... then $f->toHtml yields
<form method="GET" enctype="multipart/form-data" class="wg-formbuilder" >
<tr id="Submit_formId_row">
<td class="formDescription" valign="top" style="width: 180px;"><label for="Submit_formId">Submit</label></td>
<td valign="top" class="tableData" ><input type="button" name="Submit" id="Submit_formId" value="save" /></td>
</tr>
<tr style="display: none">
<td></td>
<td><input type="hidden" name="webgui_id" value="123456789.123456789.12" /></td>
</tr>
<tr style="display: none">
<td></td>
<td><input type="hidden" name="product_webgui_id" value="456789.123456789.12123" /></td>
</tr>
<tr id="needle_length_formId_row">
<td class="formDescription" valign="top" style="width: 180px;"><label for="needle_length_formId">Needle length</label></td>
<td valign="top" class="tableData" ><input id="needle_length_formId" type="text" name="needle_length" value="3 inches" size="30" maxlength="255" /></td>
</tr>
<tr id="gauge_formId_row">
<td class="formDescription" valign="top" style="width: 180px;"><label for="gauge_formId">Gauge</label></td>
<td valign="top" class="tableData" >
<input id="gauge_formId" type="text" name="gauge" value="55" size="11" maxlength="11"
onkeyup="doInputCheck(document.getElementById(\'gauge_formId'),'0123456789-\')"
onkeyup="doInputCheck(document.getElementById(\'gauge_formId\'),\'0123456789-\')" />
</td>
</tr>
<tr id="outer_diameter_formId_row">
<td class="formDescription" valign="top" style="width: 180px;"><label for="outer_diameter_formId">Outer Diameter</label></td>
<td valign="top" class="tableData" ><input id="outer_diameter_formId" type="text" name="outer_diameter" value="66" size="11" maxlength="11"
onkeyup="doInputCheck(document.getElementById(\'outer_diameter_formId\'),\'0123456789-\')"
onkeyup="doInputCheck(document.getElementById(\'outer_diameter_formId\'),\'0123456789-\')" /></td>
</tr>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment