We don't bite newbies here... much | |
PerlMonks |
Accessing CGI::FormBuilder text in HTML::Templateby hesco (Deacon) |
on Jun 25, 2009 at 10:38 UTC ( [id://774661]=perlquestion: print w/replies, xml ) | Need Help?? |
hesco has asked for the wisdom of the Perl Monks concerning the following question:
The perldoc for HTML::FormBuilder reports that its constructor (and its ->render() method as well) will accept a text parameter, explained as:
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? 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.
if( $lal && $lol ) { $life++; }
Back to
Seekers of Perl Wisdom
|
|