Subject: | Documentation for push_input method |
Additional fields can get added to forms through JavaScript, but its nice to use the form as parsed as a starting point. I found this post: http://www.perlmonks.org/?node_id=600562 which was exactly what I needed. It would be nice if this were made into a documented feature, so attached is a patch to do exactly that.
Subject: | HTML-Form.patch |
--- HTML-Form-6.03/lib/HTML/Form.pm Fri Mar 30 04:04:43 2012
+++ HTML-Form-6.03.new/lib/HTML/Form.pm Wed Aug 7 15:58:47 2013
@@ -325,7 +325,23 @@
$self;
}
+=item $form->push_input( $type, \%attr, $verbose )
+This method adds additional inputs to the form.
+The first argument is the type of input (e.g. hidden, option, etc.).
+The second argument is a reference to a hash of the input attributes.
+The third argument is optional, and will issue warnings about unknown input types.
+
+Example:
+
+ push_input( 'hidden', {
+ name => 'NewFormElement',
+ id => 'NewFormElementId',
+ value => 'some value',
+ });
+
+=cut
+
sub push_input
{
my($self, $type, $attr, $verbose) = @_;