Thanks a lot Narendra,
The "<!--V 'FORM:INPUT:firstName' /-->" did it for retaining the field
value.
But i still have problems for displaying error messages : i changed "B
'ERRORS:firstname'" to "B 'ERRORS:firstName'" , to have the exact same
name as the field, but RIFE then can not process the request, i get an
error :
com.uwyn.rife.template.exceptions.ValueUnknownException: The template
doesn't contain a value with id 'ERRORS'.
Thanks for your help.
Laki
Narendra Jain wrote:
Hello
To retain the value in inpu box you need to use
<!--V 'FORM:INPUT:firstName' /--> instead of html input box <input
type="text" name="firstName" length="51" maxlength="50" />
You also need to call validate() method on Bean class that sets error
messages and then if the bean is not validated then need to
generateForm with the bean.
Also check the case of field name it should be same. firstName and
firstname do not treated as same.
Regards
Naren
----- Original Message ----- From: "laki roganovic"
<[EMAIL PROTECTED]>
To: "RIFE users list : questions,bug reports and suggestions."
<[email protected]>
Sent: Monday, May 08, 2006 2:17 AM
Subject: [Rife-users] About validation...
Hello,
The problems i had the other day with my form submission were due to
an error i made in my config.
So i went further in my form processing, and now i face a problem in
form validation.
I have a super simple example :
Here is my template :
<!-- B 'ERRORS:firstname'-->
The first name is not valid.
<!--/B-->
<form action="[!V 'SUBMISSION:FORM:vip_data'/]" method="post"><!--V
'SUBMISSION:PARAMS:vip_data'/-->
<table>
<tr>
<td>First Name</td>
<td><input type="text" name="firstName" length="51"
maxlength="50" /></td>
<td><!--V 'ERRORS:firstname'/--></td>
</tr>
</table>
<input type="submit" name="Validate" /></form>
</form>
Here is my implementation :
public class InscriptionVIP extends Element {
static Logger logger = Logger.getLogger(InscriptionVIP.class);
public void processElement() {
Template template = getHtmlTemplate("myapp.inscription_vip");
VIP vip = (VIP) getNamedSubmissionBean("vip_data", "vip");
if (vip != null) {
Validated v = (Validated) vip;
if (!v.validate())
{
logger.debug("not validated");
generateForm(template, vip);
} else {
logger.debug("validated");
}
}
print(template);
}
}
Validation rules are defined in a Metadata class, associated with the
VIP class.
Here are my problems :
When i submit my form :
* The input is reset to blank.
* The error message is never printed, when the field doesn't pass
validation.
Thanks for your help.
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users