• 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: Is dynamic element action method order deterministic?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is dynamic element action method order deterministic?


  • Subject: Re: Is dynamic element action method order deterministic?
  • From: Andrew Lindesay <email@hidden>
  • Date: Wed, 17 Dec 2008 22:56:39 +1300

Hello Paul;

I find that a good way to deal with this sort of thing is to override "takeValuesFromRequest", call super, and then jiggle the data about afterwards to suit. Trying to depend on the sequence of elements on the page can become a fragile solution if the page design changes.

cheers.

Say I have the following in a HTML template:

  <wo:WOPopUpButton ... selection="$answerSelection" ... />
  <wo:WOTextField value="$otherValue" ... />

That is, the WOTextField is rendered after the WOPopUpButton. Experimentally, it looks like setAnswerSelection() is being called before setOtherValue() every time---can I rely on this behaviour?

In case the answer is no, here's the background. I have a WOPopUpButton that displays a list of choices, as well as a noSelectionString. The user can make a choice from the list, or supply an "other" value in the WOTextField, but they're mutually exclusive. I've put some Javascript on the page that does the following:

1. On the textfield's onchange event, the JS sets the pop-up to selectedIndex = 0, selecting the noSelectionString.
2. On the pop-up's onchange event, the JS clears the value in the textfield.


In Safari, at least, the JS is not reliable: specifically, if I accept an auto-completion from Safari's history, then the onchange event doesn't seem to fire, and I get a non-null selection in the pop-up, as well as text in the textfield. As a workaround, I was going to have setOtherValue() reverse the work done in setAnswerSelection() if the former is supplied with a non-null value.

To be honest, the whole approach seems a bit baroque, so if someone wants to suggest something better instead of answering the initial question, that would also be fine. :-)

___ Andrew Lindesay www.lindesay.co.nz

_______________________________________________
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


  • Follow-Ups:
    • Re: Is dynamic element action method order deterministic?
      • From: Paul Hoadley <email@hidden>
References: 
 >Is dynamic element action method order deterministic? (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Is dynamic element action method order deterministic?
  • Next by Date: Re: Is dynamic element action method order deterministic?
  • Previous by thread: Is dynamic element action method order deterministic?
  • Next by thread: Re: Is dynamic element action method order deterministic?
  • Index(es):
    • Date
    • Thread