Re: SubComponents activate Validation at the first time

"Jerry W. Walker" <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Hi, Sako,

On Mar 1, 2006, at 9:08 AM, WebObjects wrote:

> Thank you Jerry for answering,
>
> after checking what you said, indeed the validation is triggerd by  
> passing the data from the FORM to the EOCustomObjects
> and not by passing to subcomponents.
>
> I have a FORM which presents an Customer. By creating a new  
> Customer and displaying the Customer Page the attributes like
> customer.name etc... activating the validation.

This shouldn't be caused by displaying the page.

> OK, I think this is correct now.
>
> Well, what is the solution?
>
> After creating a new object like
> Customer  customer = new Customer();
> i add it to the editingContext before i change any values. However,  
> chaning this doesnt turn off the validation.

If you create a new customer (EOCustomObject) and insert it into an  
editing context, then display your page with a form that allows the  
user to enter data into the new customer instance, displaying the  
page for the user's data entry should not trigger the validation,  
whether you are using a subcomponent or not.

Unless you are explicitly triggering the validation programmatically,  
it should only be triggered when you execute saveChanges on the  
editing context. If you don't do a saveChanges before the user fills  
in the values in the form and returns the page, then you shouldn't be  
getting the "'Name' is not allowed to be null." validation error  
(unless the user fails to fill in the name).

You may be receiving the page prematurely somehow, before the user  
has had a chance to fill in the data. You can check that by  
displaying your requests and responses. Doing this has been discussed  
before on the list, so you should be able to Google for that  
information.

There was a nice write up by Malcolm Crawford on WO validation some  
years ago here:

    http://www.stepwise.com/Articles/Technical/2001-06-13.01.html

You might check it out.

> Thank you in advance.

You're welcome and good luck.

Regards,
Jerry


> ----- Original Message -----
> From: Jerry W. Walker
> To: WebObjects
> Cc: [email protected]
> Sent: Monday, February 27, 2006 9:50 PM
> Subject: Re: SubComponents activate Validation at the first time
>
> Hi, Sako,
>
> The validation methods should not be triggered by passing data to a  
> subcomponent, whether you pass that data by setting the  
> subcomponent's iVars from Main, whether you use takeValueForKey or  
> whether you set up and use the bindings in WOBuilder for the  
> subcomponent.
>
> Validation should only be occurring if you are explicitly messaging  
> one of the validation methods for one of your EOCustomObjects, or  
> you are implicitly activating them by triggering an save somehow.
>
> Regards,
> Jerry
>
> On Feb 27, 2006, at 10:21 AM, WebObjects wrote:
>
>> Hello,
>>
>> I am using Components, something like:
>> ----------------------------------------------------
>> Main
>>     SubCompoent
>>         Texts, strings, etc...
>>     End SubCompoent
>> End Main
>> ----------------------------------------------------
>>
>> The problem I have: The user opens the page to the first time.
>> By passing the data from the Main to SubComponent The validation  
>> is executed because of setXXXX methods "i guess".
>> The method validationFailedWithException passes a message like  
>> "Name" is not allowed to be null. This happens by displaying the  
>> Page at the first time.
>>
>> It is correct because the "Name" is still NULL of couarse, but  
>> this is because the user didnt have the ability to put any data.
>>
>> However, anybody has an idea, what do i miss or make wrong? thank  
>> you.
>>
>> Sako.
>> _______________________________________________
>> WebObjects-dev mailing list
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
>
> --
> __ Jerry W. Walker,
>    WebObjects Developer/Instructor for High Performance Industrial  
> Strength Internet Enabled Systems
>
>     [email protected]
>     203 278-4085        office
>
>
>
>


--
__ Jerry W. Walker,
    WebObjects Developer/Instructor for High Performance Industrial  
Strength Internet Enabled Systems

     [email protected]
     203 278-4085        office

_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.