Skip Menu |
 

This queue is for tickets about the HTML-Form CPAN distribution.

Report information
The Basics
Id: 87689
Status: open
Worked: 5 min
Priority: 0/
Queue: HTML-Form

People
Owner: Nobody in particular
Requestors: DOUGW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 6.03
Fixed in: (no value)



Subject: Documentation for push_input method
Download (untitled) / with headers
text/plain 319b
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
Download HTML-Form.patch
text/x-diff 724b
--- 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) = @_;
Download (untitled) / with headers
text/plain 297b
I just re-implemented push_input locally yesterday because I didn't know it existed. I needed it for just the reason the OP suggested: testing the behavior of something that happens by design in our web app via JS. I'd love to see this documented, so I feel better about relying on it. -- rjbs
I have created a pull request ( https://github.com/gisle/html-form/pull/4 ) that addresses this.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.