Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

form building/validation library with "embedable" fields?

by genehack (Beadle)
on Oct 09, 2008 at 01:50 UTC ( [id://716116]=perlquestion: print w/replies, xml ) Need Help??

genehack has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing a web application that's going to need to generate a bunch of arbitrary forms and then collect, validate, and store the data that users enter into these forms.

Obviously, using a form generation library is called for, and since I'm using Catalyst, it would be nice if there was some integration between that and the formgen library. The problem I'm running into is that I need to be able to "embed" form fields inside other form fields -- for example, a series of radio buttons or checkboxes that have a text field as part of the label. (To support, for instance, a "other -- specify" sort of radio button.)

Wrinkles:

  1. this "embeded" field might not always be a textfield, it may be some other element.
  2. there may be more than one "embedded" field in a given group of options
  3. the "embedded" fields will not always be associated with the last option in the group

Near as I can tell from the documentation, FormBuilder does _NOT_ support this -- is that correct? I've also looked at FormFu, which also doesn't seem like it will do this out of the box -- maybe with a lot of custom Multi element rolling, but I didn't find that section of the FormFu documents particularly easy to follow.

Any suggestions or pointers -- whether that's pointing out I'm wrong in the above assessments, pointing out another option, or pointing, laughing, and saying "start writing your own, monkey boy!" -- gratefully received.

  • Comment on form building/validation library with "embedable" fields?

Replies are listed 'Best First'.
Re: form building/validation library with "embedable" fields?
by zby (Vicar) on Oct 09, 2008 at 10:53 UTC
    "Any suggestions or pointers" - here is one: Rose::HTML::Form. I did experiment with FormFu Multi element - and I think RHF is much cleaner here.
Re: form building/validation library with "embedable" fields?
by Anonymous Monk on Oct 09, 2008 at 07:54 UTC
    and since I'm using Catalyst, it would be nice if there was some integration between that and the formgen library
    Integration (can you give an example)?
    I'd use CGI ( or CGI::FormBuilder for fancier forms) and Data::FormValidator

      Integration (can you give an example)?

      Basically what you'd get with Catalyst::Controller::FormBuilder, for example -- just some sugar. This isn't essential by any means; if it's down to writing some wrappers versus writing a whole system, that's an easy choice to make...

      I'd like to be able to use FormBuilder, I just don't see any way to make it do what I want, which would be an easy way to make something like this:

      <input type="radio" name="radio" value="foo">Foo<br> <input type="radio" name="radio" value="bar">Bar -- <input type="text" name="bar_text"><br> <input type="radio" name ="radio" value="baz">Baz<br>
      but treat it as a single logical unit at the Perl code level.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://716116]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-20 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found