• 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: Validation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Validation


  • Subject: Re: Validation
  • From: Alexandre Mainville <email@hidden>
  • Date: Tue, 12 Apr 2005 11:51:14 -0400

Thanks for the hint, tough not directly applicable to java client apps (wocomponent is web apps only) it did get me going in the right direction.


EODisplayGroup.Delegate has the following method:
public boolean displayGroupShouldDisplayAlert(EODisplayGroup group, String title, String message);

I could not find info on the default implementation but it seems it was swallowing my exceptions when "validate immediately" was on.

A simple implementation that always returns true seems to work fine (at least up until now...)

On 12-Apr-05, at 6:56 AM, Dumitru Husleag wrote:

Implement the

validationFailedWithException(Throwable t, Object value,
String keyPath)

method from WOComponent to set an error message and init the error
message in awake() to null;

In your action check the error message (the validation process starts
before your action) if not null and display the message, else do your
action.

Good luck

On 7-Apr-05, at 7:31 PM, Alexandre Mainville wrote:

In a non direct java client application, if "validate immediately" is off on the EODisplayGroup, the user gets a validation error dialog box from a NSValidation.ValidationException.

If I turn on "validate immediately", it seems the property reverts to the last known good value on a validation error. I was expecting to get the dialog box again.

Is this expected behavior? Is there anyway to get the dialog box to show when the user attemps to leave an invalid field? ( I know some people hate this behavior but that's how they want it and he who pays the piper picks the tune...)

Here is the validation method in question:

public Object validateEmail(Object object) throws NSValidation.ValidationException {
String errorMessage = "Invalid email address.";


String emailRegex = "^[a-zA-Z0-9\\._%-]+@[a-zA-Z0-9\\._%-]+\\.[a-zA-Z]{2,4}$";
String s = (String)object;


if(s.matches(emailRegex) == true ) {
// we have a valid email
return s;
}
throw new NSValidation.ValidationException(errorMessage);
}


Thanks

Alex _______________________________________________
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
 _______________________________________________
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

References: 
 >Validation (From: Alexandre Mainville <email@hidden>)

  • Prev by Date: Re: Tiger?
  • Next by Date: Re: Tiger?
  • Previous by thread: Validation
  • Next by thread: WOPopUp For Newbie
  • Index(es):
    • Date
    • Thread