hesco has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use this to pass along validation errors. However those error reports, while they seem to show up when Data::Dump'd to STDERR, never make it through the HTML::Template to the browser. I can find nothing in the documents suggesting how to pass that along. Can anyone please advise me of how to make that happen?my $form = CGI::FormBuilder->new( text => $text, # printed above form ); text => $text This is text that is included below the title but above the actual for +m. Useful if you want to say something simple like "Contact $adm for +more help", but if you want lots of text check out the "template" opt +ion above.
I've tried <tmpl_var field-text>, though that did not seem right. I also tried tmpl_var name=text>. But these are simply silly wild-eye'd guesses. A review of the module code gave me no clues (although $self->{'messages'} got me momentarily excited that I might have been on to something useful, it turned out to be about choosing a locale for translation instead).
Seems to me that feeding custom data validation error messages into the constructor would be a useful feature to add to the CGI::FormBuilder mix, but for the moment, I only need to figure out how to hand off my hand-rolled to the HTML::Template I'm using.
Any advice is appreciated.
-- Hugh
UPDATE:
Well, I hacked around it, TIMTOWTDI, I guess. I embedded a replacement token in my template, generated the html from the template and then used $html =~ s/VALIDATION_ERRORS/$text/; and kept on moving. Even so, I think it would be a sweet addition to CGI::FormBuilder to permit the definition of validation error strings in the validate => {} hashref fed to the constructor. Though not sweet enough an addition to justify being distracted from the critical path for launch of this current project.
Oh, btw, wfsp, having reread the perldoc for CGI::FormBuilder::Messages, I believe that is a tool for translation and localization, not for the purpose I'm working on right now. Though I remain curious about how those messages are used, since I have not seen any evidence of them on validation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing CGI::FormBuilder text in HTML::Template
by wfsp (Abbot) on Jun 25, 2009 at 11:24 UTC |