Re: Checking An Integer Is An Integer
Re: Checking An Integer Is An Integer
- Subject: Re: Checking An Integer Is An Integer
- From: "Jonathan Fleming" <email@hidden>
- Date: Mon, 24 Feb 2003 15:16:52 +0000
From: George Domurot <email@hidden>
To: "Jonathan Fleming" <email@hidden>
CC: email@hidden, email@hidden
Subject: Re: Checking An Integer Is An Integer
Date: Mon, 24 Feb 2003 09:48:50 -0500
I don't believe anything but an Integer or null will be sent through this
method. The only other thing I believe you need to check for is if the
Integer is not less than zero:
if (newCountOfUploadRemainger.intValue()<0)
throw new NSValidation.ValidationException("...");
That don't work George. I still get this:
Error: java.lang.NumberFormatException
Jonathan
On Monday, February 24, 2003, at 09:30 AM, Jonathan Fleming wrote:
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.
_______________________________________________
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.
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends
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.