takeValuesFromForm Validation
takeValuesFromForm Validation
- Subject: takeValuesFromForm Validation
- From: Owen McKerrow <email@hidden>
- Date: Wed, 1 Aug 2007 12:18:06 +1000
Hi All,
I have an attribute in an entity that has a width of 1500 char. I
have over ridden the validate method for it inside the entities java
class.....
public String validateRqfJustification(String newState) throws
NSValidation.ValidationException
{
if ( newState != null ) {
if (newState.length() > 1500) {
throw new NSValidation.ValidationException("The RQF Justification
can not be longer than 1500 characters");
}
}
return newState;
}
This gets called fine when I try to save it.
However if I submit the form and the text field contains more than
1500 chars, a validation error is thrown, without going into this
method because it checks it against the width inside the model.
I catch this exception inside the component
validationFailedWithException() method, the page gets return I
display the error message ( not the nicely formatted one form above,
but the default one ). BUT the value of the form in the feild has
been reset to what it was before they click the button. This is not
what I want. I want to tell them they can't save but the value in the
field should stay the same as what they just typed.
So 2 questions :
1) When a form is submitted why doesn't it use my validation method
for that attribute ? What validation is it calling ? i.e.
validateforUpdate() ?
2) How can I get the value the user typed to stay in the form,
instead of being truncated back ?
Owen McKerrow
WebMaster, emlab
Ph : +61 02 4221 5517
http://emlab.uow.edu.au
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
'The test of a first-rate intelligence is the ability to hold two
opposed ideas in the mind at the same time and still be able to
function.'
-F.Scott Fitzgerald,
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden