• 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: SOLVED: problem with willInsert() and willUpdate() when using D2W.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SOLVED: problem with willInsert() and willUpdate() when using D2W.


  • Subject: Re: SOLVED: problem with willInsert() and willUpdate() when using D2W.
  • From: Mark Wardle <email@hidden>
  • Date: Mon, 19 Oct 2015 15:35:04 +0100

For the avoidance of doubt, this should read:

Dear all,

I thought I would share a tricky problem and its solution.

I have implemented willInsert() and willUpdate() and used them successfully. Oddly, they didn’t seem to get called during the editing or creation of a new entity and so I was getting validation errors.

It sounds simple now but the D2W edit page checks a D2W key called shouldValidateBeforeSave which means that validateForInsert() or validateForSave() is called BEFORE willInsert or willUpdate. The documentation for ERXEnterpriseObject of course suggests that willInsert/willUpdate will be called BEFORE validation. Simply setting D2W key shouldValidateBeforeSave to false resolves the issue.

Therefore, if you are using D2W and you have odd willInsert or willUpdate errors, then check here. The source code for ERD2WInspectPage shows this clearly enough although I can’t work out why anyone would want to explicitly call validate before save given that validation should occur before saving simply during saveChanges().

Best wishes,

Mark

On 19 Oct 2015, at 15:32, Mark Wardle <email@hidden> wrote:

Dear all,

I thought I would share a tricky problem and its solution.

I have implemented willInsert() and willUpdate() and used them successfully. Oddly, they didn’t seem to get called during the editing or creation of a new entity and so I was getting validation errors.

It sounds simple now but the D2W edit page checks a D2W key called shouldValidateBeforeSave which means that validateForInsert() or validateForSave() is called BEFORE willInsert or willUpdate. The documentation for ERXEnterpriseObject of course suggests that willInsert/willUpdate will be called AFTER validation. Simply setting D2W key shouldValidateBeforeSave to false resolves the issue.

Therefore, if you are using D2W and you have odd willInsert or willUpdate errors, then check here. The source code for ERD2WInspectPage shows this clearly enough although I can’t work out why anyone would want to explicitly call validate before save given that validation should occur before saving simply during saveChanges().

Best wishes,

Mark

— 
Mark Wardle
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: 
 >SOLVED: problem with willInsert() and willUpdate() when using D2W. (From: Mark Wardle <email@hidden>)

  • Prev by Date: SOLVED: problem with willInsert() and willUpdate() when using D2W.
  • Next by Date: Yet another newby question on the tutorial
  • Previous by thread: SOLVED: problem with willInsert() and willUpdate() when using D2W.
  • Next by thread: Yet another newby question on the tutorial
  • Index(es):
    • Date
    • Thread