Re: Is dynamic element action method order deterministic?
Re: Is dynamic element action method order deterministic?
- Subject: Re: Is dynamic element action method order deterministic?
- From: Chuck Hill <email@hidden>
- Date: Wed, 17 Dec 2008 15:18:53 -0800
On Dec 17, 2008, at 1:47 PM, Paul Hoadley wrote:
On 18/12/2008, at 4:29 AM, Chuck Hill wrote:
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. :-)
I think Andrew's solution is working so I will leave this alone.
Feel free to weigh in. :-)
I'm still using the JS on the page, because it provides a visual cue
to what is going on. If takeValuesFromRequest() notes input values
from both the pop-up and the textfield, it sets a boolean flag
(which has been reset in awake()). In setAnswerSelection() (for the
pop-up), if the flag is set then the method pretends it received
null and behaves accordingly.
It appears to work. Andrew---is this what you meant? Chuck---do
you have a different approach?
No, nothing fundamentally or interestingly different. It is kind of a
messy problem.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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