Oh, right.

I implemented this. My brain is a sieve.

;)

Anyways, don't go with #{}, that's wrong here!

regards,

Martin

On 12/1/05, Matthias Kahlau <[EMAIL PROTECTED]> wrote:
> Hi Martin!
>
>
> As I know from the example 1 of the Apache MyFaces jsValueChangeListener Web
> site, I don't need to use the $destElem to achieve a change in the target
> element:
>
> Example 1
> Suppose we have two text fields on a page. We would like to keep the value
> of the second text field in sync with the value of the first. This can be
> accomplised with the following code:
>
>                <h:inputText id="text1">
>                    <t:jsValueChangeListener for="text2" property="value"
>                                                expressionValue="$srcElem.va
> lue" />
>                </h:inputText>
>                <h:inputText id="text2"/>
>
> When the value of text1 changes, the 'onchange' event is triggered. The
> javascript expression specified by 'expressionValue' is evaluated, and the
> result is assigned to the specified property (in this case, 'value') of the
> target control.
>
>
> But I don't need to use JavaScript at the moment because of changing
> requirements, so that's not an acute problem I'm working on. That's why I
> won't debug the JavaScript for the moment, maybe it will be necessary
> later...
>
>
>
> Regards,
> Matthias
>
> > -----Ursprüngliche Nachricht-----
> > Von: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Auftrag
> > von Martin Marinschek
> > Gesendet: Donnerstag, 1. Dezember 2005 19:47
> > An: MyFaces Discussion
> > Betreff: Re: jsValueChangeListener - how to detect radio button
> > selections
> >
> >
> > no, no, it's surely not the expression syntax you need to use. This
> > would be evaluated in the Faces-Subsystem, not by JavaScript.
> >
> > I wonder from your expression what you want to achieve - you'll need
> > to set something to a destElem for the listener to make sense.
> >
> > In any case, your original string was correct, obviously it doesn't
> > make any sense with the rest of your component tree, though.
> >
> > Fire up your JavaScript debugger and step into
> >
> > JSListener.js
> >
> > function orgApacheMyfacesJsListenerSetExpressionProperty(
> >     srcId, destId, property, expression)
> > {
> >
> > to find out what happens.
> >
> > regards,
> >
> > Martin
> >
> > On 12/1/05, Matthias Kahlau <[EMAIL PROTECTED]> wrote:
> > > Hi Rafael,
> > >
> > >
> > > you're right, the JSF EL syntax must be used. The information on the
> > > jsValueChangeListener Web page of the Apache MyFaces Web site seems
> > > out-dated or obsolete:
> > >
> > > http://myfaces.apache.org/tomahawk/javascriptListener.html
> > >
> > > But despite of using the JSF EL syntax, the approach used to
> > react to value
> > > change events of radio button selections seems not to work. The
> > first click
> > > shows a reaction, setting false in the inputText. All following
> > selections
> > > doesn't change the inputText - true can never be set in the inputText,
> > > although the selectOneRadio, which is the parent of the
> > > jsValueChangeListener, has 4 radio buttons.
> > >
> > >
> > > <t:jsValueChangeListener for="inputTextId"
> > >     property="value"
> > >     expressionValue="#{srcElem[2].checked ? 'true' :
> > > 'false'}" />
> > >
> > >
> > > Regards,
> > > Matthias
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED]
> > > Auftrag von Rafael Nami
> > > Gesendet: Donnerstag, 1. Dezember 2005 12:36
> > > An: MyFaces Discussion
> > > Betreff: Re: jsValueChangeListener - how to detect radio button
> > selections
> > >
> > > Did you tried using #{srcElem[2].checked ? 'true' : 'false'} instead of
> > > $srcElem[2].checked ? 'true' : 'false' ??
> > >
> > > Best Regards
> > >
> > > Rafael Mauricio Nami
> > >
> > > 2005/11/30, Matthias Kahlau <[EMAIL PROTECTED]>:
> > > > Hi!
> > > >
> > > >
> > > > I tried to use the t:jsValueChangeListener to react, when a
> > specific radio
> > > > button is selected or deselected, but got the following errors in the
> > > > Firefox 1.0 JavaScript console (but didn't also work in
> > Internet Explorer
> > > > 6):
> > > >
> > > >
> > > > uncaught exception: Error encountered : srcElem has no properties
> > > > undefinedSource-Element id: _id1:ergPubBeginnRadios
> > > > Source-element: null
> > > > Type of source-element: object
> > > >
> > > >
> > > > I used the following approach inside a selectOneRadio (with
> > > > id="ergPubBeginnRadios") just to test:
> > > >
> > > > <t:jsValueChangeListener for="inputTextId"
> > > >         property="value"
> > > >                 expressionValue="$srcElem[2].checked ?
> > > 'true' : 'false'" />
> > > >
> > > >
> > > > Does anybody know what's wrong?
> > > >
> > > >
> > > > Regards,
> > > > Matthias
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to