Hi Gregory,
This is how I handle your problem:
I have a data source of error messages, an sql database or a flat file (If I
use a flat file, then I make the file contain a data structure so I can just
$main::errors = eval { do $filename }, I can provide an example if you
want). I seperate my error messages like that, so the html designers can
change the error messages to be whatever they want without needing to change
the code.
Then, in my code, I have the logic that checks the different error
conditions, and sets the error message... like so:
if ( ! $c->param('date2') ) {
$errors = { 'ERRMSG' => $main::errors->{'MISSING_REQUIRED_FIELD'} } ;
}
elsif (..... ) {
....
}
...
if ( defined ( $errors ) ) {
$template->param( $errors );
}
Then in the template, I use:
<TMPL_IF NAME=ERRMSG>
<font color=red><TMPL_VAR NAME=ERRMSG></font>
</TMPL_IF>
Kenny Smith
JournalScape.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Gregory Stark
Sent: Wednesday, May 01, 2002 1:08 PM
To: htmltmpl
Subject: [htmltmpl] Multiple form constraints
How do I have multiple form constraints that affect the same columns but
have
different error messages?
Specifically, I have two date fields, both fields are required, both must be
in the correct format, and the second must be a later date than the first.
Ideally I would want three separate messages
"Date2 is a required field"
"Date2 must be in format xxx"
"Date2 must be later than Date1"
And only the single message that's appropriate should appear, not all of
them.
--
Gregory Stark
Ideas And Associates
T +1 514 940 2891 x111
H +1 514 486 9705
C +1 514 945 3796
F +1 209 828 3730
http://www.ideasandassociates.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]