• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checking An Integer Is An Integer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking An Integer Is An Integer


  • Subject: Re: Checking An Integer Is An Integer
  • From: George Domurot <email@hidden>
  • 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("...");

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.

References: 
 >Checking An Integer Is An Integer (From: "Jonathan Fleming" <email@hidden>)

  • Prev by Date: Checking An Integer Is An Integer
  • Next by Date: Re: Checking An Integer Is An Integer
  • Previous by thread: Checking An Integer Is An Integer
  • Next by thread: Re: Checking An Integer Is An Integer
  • Index(es):
    • Date
    • Thread