in reply to Problems with using Cgi::FormBuilder

1... How do I set so that values and displayed text differ? "options" sets everything. Is there a way of separating and setting the two separately?

Supply an array ref, see examples in test suite http://search.cpan.org/dist/CGI-FormBuilder/MANIFEST

2. I would like to implement my own validation for certain fields on the server-side and I need to be able to set certain fields manually that they are invalid. How do I do that?

As per http://search.cpan.org/perldoc/CGI::FormBuilder#validate simply supply your own regex, or your own Data::FormValidator profile

3. I would like to add html code in checkbox labels, how do I do that? Currently, html code in labels somehow do not go through

Search CGI::FormBuilder for $html to see where you can add your own $html, your other option is to create your own templates

See also http://web.archive.org/web/20100625050132/http://www.formbuilder.org/tutor/

  • Comment on Re: Problems with using Cgi::FormBuilder

Replies are listed 'Best First'.
Re^2: Problems with using Cgi::FormBuilder
by aftershock (Sexton) on Apr 10, 2012 at 19:47 UTC
    You guided towards the solution. The solution:
    $form->field( name => 'answers', label => 'Answers:', type => 'checkbox', multiple => 1, options => [['value','displayed1'],['value2','displayed2']] +, add_after_option => "<br>", linebreaks => 1, cleanopts => 0, validate => \&sub_call );

    See options solves 1.

    validate => \&sub_call solves 2.

    cleanopts solve 3.

    See options solves 1.