Checking An Integer Is An Integer
Checking An Integer Is An Integer
- Subject: Checking An Integer Is An Integer
- From: "Jonathan Fleming" <email@hidden>
- Date: Mon, 24 Feb 2003 14:30:26 +0000
I am trying to use the code below to do some validation on a WOTextField
that is bound to an String var and entered into the database progmatically
by setting the value of it's corresponding EOCustomObject.
Basically I want to validate that a character is not trying to be entered
into the database.
Here the code I am using, how do I complete it?
// CountOfUploadRemainder: is a required field in the form
public Integer validateCountOfUploadRemainder(Integer
newCountOfUploadRemainder)
throws NSValidation.ValidationException {
if (newCountOfUploadRemainder == null) {
throw new NSValidation.ValidationException("Enter 0 if you
are not uploading any images, otherwise state the number of images you wish
to upload. Enter only digits and avoid text characters. Try something like
\"1\", \"01\", \"10\" etc.");
}
if (newCountOfUploadRemainder != null)
{
// THIS IS WHERE i NEED THAT VALIDATION
// THE CODE HERE IS NOT RIGHT, DON'T KNOW WHAT TO USE
char c = newCountOfUploadRemainder;
if (!Character.isDigit(c))
{
throw new NSValidation.ValidationException("The value
\"" + newCountOfUploadRemainder + "\" is not a valid number. Use only digits
and avoid text characters. Try something like \"1\", \"01\", \"10\" etc.");
}
}
return newCountOfUploadRemainder;
}
I would appreciate your help... Thanks
Jonathan
_________________________________________________________________
Express yourself with cool emoticons http://messenger.msn.co.uk
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.