Here is a D::FV that works.
sub qs_process { my $self = shift; my $dbh = $self->param('mydbh'); my ($results, $err_page) = $self->check_rm('qs_display', { required => [qw/upfirstname uplastname upemail upusername uppa +ssword confirm_password/], optional => [qw/upzip upcountry/], filters => ['trim'], constraints => { uppassword => { #Make sure passwords are the same name => 'user_passwords', constraint => \&check_password, params => [qw(uppassword confirm_password)], }, upusername => { #Is username unique? name => 'user_username', constraint => sub { !$self->check_username(lc $_[0]); +} }, upemail => 'email', upzip => 'zip_or_postcode', }, msgs => { any_errors => 'err__', prefix => 'err_', constraints => { 'user_passwords' => "Your passwords don't match", 'user_username' => "Username not unique", }, }, } ); return $err_page if $err_page; # #Stuff here to handle case of validation being succesfull.
Don't forget that your template must have a set of TMPL_VAR fields that match the error messages. This code is not functional as it has a couple of external validation functions you can't see.

Here is a fragment of the template that is used for this form, note the 'err_' series of TMPL_VAR's in the third column.

<form method="post" action="/app/app02.cgi"> <table border="0" cellpadding="0" cellspacing="2" width="490"> <tr> <td class="lbl" colspan="3"><font size="-1">Using this + form you can sign up for preview privileges on our system. You will +be able to see everything a full member would see, the only thing you + cannot do is actually make appointments.</font></td> </tr> <tr> <td class="lbl" width="160">First Name</td> <td class="value" width="230"><input type="text" name="upf +irstname" size="20"></td> <td class="err"><tmpl_var err_upfirstname></td> </tr> <tr> <td class="lbl" width="160">Last&nbsp;Name</td> <td class="value" width="230"><input type="text" name="upl +astname" size="20"></td> <td class="err"><tmpl_var err_uplastname></td> </tr>

If you want to see it at work it is on a development server at: http://posiedon.mine.nu/app/app02.cgi?rm=mode_001

jdtoronto PS I am on my out for about 8 hours, but msg me if you want some help and I can help later.


In reply to Re: Retrieving "msgs" values from Data::FormValidator by jdtoronto
in thread Retrieving "msgs" values from Data::FormValidator by Hagbone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.