• 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: validationFailedWithException not being called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: validationFailedWithException not being called


  • Subject: Re: validationFailedWithException not being called
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 7 Jun 2007 14:04:05 -0700


On Jun 7, 2007, at 1:43 PM, Janine Sisk wrote:

I'm totally stumped by this.  Here's the scenario:

The user chooses a file to upload that we can't handle. They hit the submit button. My saveChanges method runs,

Does not! :-P At least not exactly like that. Here is what really happens:


takeValuesFromRequest runs, calls validateValueForKey on the EO for each form value. If the value is valid, it then calls setValueForKey. If the value is not valid, it calls validationFailedWithException.

When that is all finished, it starts on invokeAction. That is when your saveChanges runs.


which runs the built-in one, which validates all the attributes in my model.

Yes, a second time. But the failure during takeValues... has already happened and you should check for it not _not_ call ec. saveChanges (). Just refresh the page and show the validation error messages(s).



My validateBigImage method runs, which checks the image and sees that it's the wrong kind, so it throws an NSValidation.ValidationException. This would, one would think, cause validationFailedWithException to run, but it doesn't.

It should, during the takeValuesFromRequest phase. Calling that is something that WOAssocation does. WOAssociaton is an object created from one binding in the WOD file. More than you wanted to know, eh?



Why not, and/or how do I figure out what's going on? I figured out how to use the debugger, set a breakpoint on the line where I throw my exception, and followed it the rest of the way through. Other than verifying that it never goes in to validationFailedWithException, which I already knew, it didn't tell me much.

It _should_ be getting to that method. Look at there it is getting throw. Look up (down) in the stack trace. Do you see takeValuesFromRequest? Anything about a WOAssociation? Is the method signature correct?



Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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


  • Follow-Ups:
    • Re: validationFailedWithException not being called
      • From: Janine Sisk <email@hidden>
    • Re: validationFailedWithException not being called
      • From: Janine Sisk <email@hidden>
References: 
 >validationFailedWithException not being called (From: Janine Sisk <email@hidden>)

  • Prev by Date: validationFailedWithException not being called
  • Next by Date: Re: validationFailedWithException not being called
  • Previous by thread: validationFailedWithException not being called
  • Next by thread: Re: validationFailedWithException not being called
  • Index(es):
    • Date
    • Thread