• 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: takeValuesFromRequest question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: takeValuesFromRequest question


  • Subject: Re: takeValuesFromRequest question
  • From: email@hidden
  • Date: Tue, 20 Sep 2005 15:24:02 +0200

----- Original Message -----
From: "Miguel Arroz" <email@hidden>
To: "WebObjects Development" <email@hidden>
Sent: Tuesday, September 20, 2005 3:04 PM
Subject: takeValuesFromRequest question


> Hi!
>
>    First, sorry about posting so many basic question on this list...
> i'm really enjoying learning WO, and I want to know some details
> about the framework! :)
>
>    I'm trying to define a component (called ErrorLabel) that might
> (or not) display an error. The ideia is to put an instance of
> ErrorLabel next to a TextField, button, etc, so that when the value
> the user introduces is wrong, and error label appears next to that
> element.
>
>    I've learned that a component gets the values from the interface
> and sets them on the model object during the execution of
> takeValuesFromRequest. My ideia was to build validators on the model
> class, and catch the exceptions on the component.
This is good idea, WO has the following solution:
if you have property email  then just create the method
    public String validateEmail (String email  )
    {
        // da any stuff here
        return email ;
    }
WO will execute this method everytime takeValuesFromRequest is called.
You create for every property a method.

HTH,
Sako.

>
>    The problem is that the takeValuesFromRequest is catching all the
> exceptions, and printing error messages on the console, like
> "[2005-09-20 13:41:29 WEST] <WorkerThread3> Validation failed on an
> object [null] with keypath = publicTicket.email and exception: The
> email property of Ticket is not allowed to be null."
>
>    How can I catch this exceptions, so that I may turn on the
> visibility of the error labels? Of course, I may redefine
> takeValuesFromRequest so that I grab all the values manually, and
> surround the code with a try/catch, but that looks lot a lot of
> pointless work, and lack of abstraction (if I need to add or remove a
> component, I will have to change that code manually). Following the
> "If you are writing code, you are doing something wrong" WebObjects
> non-official slogan, is there a better way to do this?
>
>    Yours
>
> Miguel Arroz
>
> "We have no sympathy for the lost souls
> We've chosen the path of disgrace
> We give this life to our children
> And teach them to hate this place" -- Apocalyptica, Life Burns!
>
> Miguel Arroz
> http://www.ipragma.com
>
>
>  _______________________________________________
> 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

References: 
 >takeValuesFromRequest question (From: Miguel Arroz <email@hidden>)

  • Prev by Date: takeValuesFromRequest question
  • Next by Date: Re: takeValuesFromRequest question
  • Previous by thread: takeValuesFromRequest question
  • Next by thread: Re: takeValuesFromRequest question
  • Index(es):
    • Date
    • Thread