Hi Ramsey,
>> swallowed in ERD2WPage since d2wContext().propertyKey() is null. Setting the
>> propertyKey from the exception resolves this:
>>
>> if (d2wContext().propertyKey() == null && erv.propertyKey() !=
>> null) {
>> d2wContext().setPropertyKey(erv.propertyKey());
>> }
>>
>> Maybe this (or some better solution) should be added to ERD2W?
>
> I don't remember exactly why I didn't do this, but I think it broke query
> validation. Hence why I wanted to make a pluggable validation delegate. The
> logic in there has become so overloaded, it's difficult to make changes
> without breaking something for someone, somewhere :-)
I haven't yet looked into query validation. How could I test this?
>> It seems to me that the whole validationKeys approach is unusable otherwise?
>
> Using validateKeys would be the correct approach. But were you actually able
> to display the error with validateKeys on an ERMODWizard page? Last time I
> tried that, it didn't work...
>
> https://github.com/projectwonder/wonder/issues/97
Well, with the modification above it works for me. That's the only thing I had
to change for it to work.
I still wonder why this missing validation seems not to bother anybody. I'd
expect validation of mandatory to-ones to "just work". It's no fun if you edit
something and on the 7th step you're told you forgot to set a property on the
1st step. Or is there something I'm overlooking?
cheers, Fabian
> Ramsey
>
>>
>> Any input appreciated!
>>
>> cheers, Fabian
>>
>>
>> Am 26.08.2011 um 17:51 schrieb Ramsey Gurley:
>>
>>>
>>> On Aug 26, 2011, at 2:05 AM, David Avendasora wrote:
>>>
>>>> Hey D2Wers,
>>>>
>>>> So, I have business logic that executes in the setter of one of my
>>>> attributes.
>>>
>>> In the setter? Any reason why you don't use validate<Key>() or maybe
>>> validateFor*()? I've learned the hard way that business logic in a setter
>>> is a sign of bad things to come. It's like exposing PKs and FKs. It
>>> works… sorta, for a while… but sooner or later… BLAM!
>>>
>>>> It's checking to make sure that at least one of a set of objects has a
>>>> flag set. If you try to remove the flag off the last object it should not
>>>> allow it and throw and exception.
>>>>
>>>> All that works just fine.
>>>>
>>>> Now I want to catch that exception and display it to the user in a
>>>> friendly way. Ideally basically the same as how standard validation
>>>> exceptions are displayed in red at the top of the page in ERModernLook.
>>>>
>>>> I've tried throwing a ValidationException and also tried other exceptions,
>>>> and either it is ignored with no user feedback (ValidationException), or I
>>>> get the standard, completely disruptive exception page (for all others).
>>>>
>>>> I've tried to find the extension point to put in my own exception
>>>> handling, but it's apparently not where I thought it was -
>>>> ERD2WInspectPage#tryToSaveChanges.
>>>>
>>>> Am I doing it wrong, or just looking in the wrong place?
>>>>
>>>> Dave
>>>
>>> I suspect your validation exception may be getting swallowed in ERD2WPage's
>>> validationFailedWithException method. Put a breakpoint in there and follow
>>> the execution. If you throw an ERXValidationException and the
>>> d2wContext().propertyKey() is null, then the exception never makes it into
>>> the error messages dictionary.
>>>
>>> I've planned on fixing this, but I want to make the validation handling use
>>> a plugable delegate with a default similar to the one now. That way, I
>>> hope to build a new implementation so that I can provide enhanced
>>> validation on something like an editable list page where you may have
>>> multiple objects with different validation exceptions related to them.
>>>
>>> Ramsey
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
>>>
>>> This email sent to [email protected]
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>>
>> This email sent to [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]