Re: Validation and d2wcontext?
Re: Validation and d2wcontext?
- Subject: Re: Validation and d2wcontext?
- From: David LeBer <email@hidden>
- Date: Thu, 16 May 2013 12:09:00 -0400
Yeah, tend to agree with Ramsey on this.
We've had validation for a group of attributes be conditional on another, for instance an application object has a state (preparing, submitted, approved) etc. The requirements were for the application to be saveable when only partially completed in the preparing state, but to be submitted it needed to conform to the submission requirements.
So what are the business requirements that govern the validation rules, do they really depend on the 'task' or is that just a proxy for something else?
D
--
David LeBer
Codeferous Software
On 2013-05-16, at 11:09 AM, Ramsey Gurley <email@hidden> wrote:
> You shouldn't do that. Validation is for validating model logic. If something changes based on the task, that is control logic.
>
> If you have a distinct class of objects that work differently, then you should use inheritance.
>
> If it isn't a distinct class, then you might do some model validation based on associated user roles or something.
>
> But just saying, "Oh, this is an edit page, do one thing. This is a create page, do something else." is the wrong way to use EOF validation. Note, in this case, you could still have model logic based on eo.isNewObject, which makes sense.
>
> Ramsey
>
> On May 16, 2013, at 6:30 AM, James Cicenia wrote:
>
>> Hello -
>>
>> I want my validation logic to change depending on the "task" of my context.
>>
>> The question is, how does one do this? Since my validationAttributeKey
>> method is in the modeled entity, how can I grab d2wcontext() ?
>>
>> Or is there a way to change the validation via rules?
>>
>> Thanks
>> James
>> _______________________________________________
>> 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
_______________________________________________
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