You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> on 2006/08/02 13:13:47 UTC

jsValueChangeListener - field does not get updated in realtime, only after focus

Looking at the examples i tried this:

                <h:inputText id="text1">
                    <t:jsValueChangeListener for="text2" property="value" 
                                                expressionValue="$srcElem.value.length" />
                </h:inputText>
                <h:inputText id="text2"/>

Does work - but the value if text2 is only updated if it gets the focus, i can write in the first field what i want - field2 
stays the same and shows nothing until it gets the focus.
Changing the second inputTex in an outputText shows nothing ( but it should? )
Any hints?

I want to have something like:
User is writing in first field, an outputText after that field shows the length of what the user have inserted, updating with ervery 
change event - i thought this tag should do the work, should it?

kind regards


ps: using myfaces + tomahawk v1.1.4 + facelets 1.1.11


Re: jsValueChangeListener - field does not get updated in realtime, only after focus

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Yeah - its a onBlur Listener ;).

But your are right, using my own JS i can do the same - but like you can
see at my next post to the list, forceId on inputText is maybe broken,
but for outputText it works - so i got it working, using this as
referenz for the component which triggered the event, so i don't have to
search for.

kind regards

Torsten

Am Mittwoch, den 02.08.2006, 15:21 +0200 schrieb Gerald Müllan:
> I think this is the wanted behaviour and the component doesn`t trigger
> on keypress events.
> 
> In this case its onblur.
> 
> If you want to achieve the "realtime" stuff, it shouldn`t  be that
> difficult to do it by hand. Just enable the onkeypress attribute and
> write the length of the value to the destination element by plain js.
> 
> Don`t forget to use forceId of the dest element in order to get only
> the id without the prefixes.
> 
> cheers,
> 
> Gerald
> 
> On 8/2/06, Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> > Thx works - IE doesnt matter if it works or not.
> >
> > But still there is the issue - it updates not on demand, i have to focus
> > another component for update, is this a wanted behaviour or an issue?
> >
> > Am Mittwoch, den 02.08.2006, 14:11 +0200 schrieb Gerald Müllan:
> > > Hi,
> > >
> > > don`t know if this will work, but what about setting the expression to:
> > >
> > > $destElem.innerHTML = $srcElem.value.length
> > >
> > > and the destination element is your outputText component. But maybe
> > > there are issues with innerHTML an IE.
> > >
> > > cheers,
> > >
> > > Gerald
> > >
> > > On 8/2/06, Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> > > > Looking at the examples i tried this:
> > > >
> > > >                 <h:inputText id="text1">
> > > >                     <t:jsValueChangeListener for="text2" property="value"
> > > >                                                 expressionValue="$srcElem.value.length" />
> > > >                 </h:inputText>
> > > >                 <h:inputText id="text2"/>
> > > >
> > > > Does work - but the value if text2 is only updated if it gets the focus, i can write in the first field what i want - field2
> > > > stays the same and shows nothing until it gets the focus.
> > > > Changing the second inputTex in an outputText shows nothing ( but it should? )
> > > > Any hints?
> > > >
> > > > I want to have something like:
> > > > User is writing in first field, an outputText after that field shows the length of what the user have inserted, updating with ervery
> > > > change event - i thought this tag should do the work, should it?
> > > >
> > > > kind regards
> > > >
> > > >
> > > > ps: using myfaces + tomahawk v1.1.4 + facelets 1.1.11
> > > >
> > > >
> > >
> > >
> >
> >
> 
> 


Re: jsValueChangeListener - field does not get updated in realtime, only after focus

Posted by Gerald Müllan <bi...@gmail.com>.
I think this is the wanted behaviour and the component doesn`t trigger
on keypress events.

In this case its onblur.

If you want to achieve the "realtime" stuff, it shouldn`t  be that
difficult to do it by hand. Just enable the onkeypress attribute and
write the length of the value to the destination element by plain js.

Don`t forget to use forceId of the dest element in order to get only
the id without the prefixes.

cheers,

Gerald

On 8/2/06, Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> Thx works - IE doesnt matter if it works or not.
>
> But still there is the issue - it updates not on demand, i have to focus
> another component for update, is this a wanted behaviour or an issue?
>
> Am Mittwoch, den 02.08.2006, 14:11 +0200 schrieb Gerald Müllan:
> > Hi,
> >
> > don`t know if this will work, but what about setting the expression to:
> >
> > $destElem.innerHTML = $srcElem.value.length
> >
> > and the destination element is your outputText component. But maybe
> > there are issues with innerHTML an IE.
> >
> > cheers,
> >
> > Gerald
> >
> > On 8/2/06, Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> > > Looking at the examples i tried this:
> > >
> > >                 <h:inputText id="text1">
> > >                     <t:jsValueChangeListener for="text2" property="value"
> > >                                                 expressionValue="$srcElem.value.length" />
> > >                 </h:inputText>
> > >                 <h:inputText id="text2"/>
> > >
> > > Does work - but the value if text2 is only updated if it gets the focus, i can write in the first field what i want - field2
> > > stays the same and shows nothing until it gets the focus.
> > > Changing the second inputTex in an outputText shows nothing ( but it should? )
> > > Any hints?
> > >
> > > I want to have something like:
> > > User is writing in first field, an outputText after that field shows the length of what the user have inserted, updating with ervery
> > > change event - i thought this tag should do the work, should it?
> > >
> > > kind regards
> > >
> > >
> > > ps: using myfaces + tomahawk v1.1.4 + facelets 1.1.11
> > >
> > >
> >
> >
>
>


-- 
Gerald Müllan
Schelleingasse 2/11
1040 Vienna, Austria
0043 699 11772506
gerald.muellan@gmail.com

Re: jsValueChangeListener - field does not get updated in realtime, only after focus

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Thx works - IE doesnt matter if it works or not.

But still there is the issue - it updates not on demand, i have to focus
another component for update, is this a wanted behaviour or an issue?

Am Mittwoch, den 02.08.2006, 14:11 +0200 schrieb Gerald Müllan:
> Hi,
> 
> don`t know if this will work, but what about setting the expression to:
> 
> $destElem.innerHTML = $srcElem.value.length
> 
> and the destination element is your outputText component. But maybe
> there are issues with innerHTML an IE.
> 
> cheers,
> 
> Gerald
> 
> On 8/2/06, Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> > Looking at the examples i tried this:
> >
> >                 <h:inputText id="text1">
> >                     <t:jsValueChangeListener for="text2" property="value"
> >                                                 expressionValue="$srcElem.value.length" />
> >                 </h:inputText>
> >                 <h:inputText id="text2"/>
> >
> > Does work - but the value if text2 is only updated if it gets the focus, i can write in the first field what i want - field2
> > stays the same and shows nothing until it gets the focus.
> > Changing the second inputTex in an outputText shows nothing ( but it should? )
> > Any hints?
> >
> > I want to have something like:
> > User is writing in first field, an outputText after that field shows the length of what the user have inserted, updating with ervery
> > change event - i thought this tag should do the work, should it?
> >
> > kind regards
> >
> >
> > ps: using myfaces + tomahawk v1.1.4 + facelets 1.1.11
> >
> >
> 
> 


Re: jsValueChangeListener - field does not get updated in realtime, only after focus

Posted by Gerald Müllan <bi...@gmail.com>.
Hi,

don`t know if this will work, but what about setting the expression to:

$destElem.innerHTML = $srcElem.value.length

and the destination element is your outputText component. But maybe
there are issues with innerHTML an IE.

cheers,

Gerald

On 8/2/06, Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> Looking at the examples i tried this:
>
>                 <h:inputText id="text1">
>                     <t:jsValueChangeListener for="text2" property="value"
>                                                 expressionValue="$srcElem.value.length" />
>                 </h:inputText>
>                 <h:inputText id="text2"/>
>
> Does work - but the value if text2 is only updated if it gets the focus, i can write in the first field what i want - field2
> stays the same and shows nothing until it gets the focus.
> Changing the second inputTex in an outputText shows nothing ( but it should? )
> Any hints?
>
> I want to have something like:
> User is writing in first field, an outputText after that field shows the length of what the user have inserted, updating with ervery
> change event - i thought this tag should do the work, should it?
>
> kind regards
>
>
> ps: using myfaces + tomahawk v1.1.4 + facelets 1.1.11
>
>


-- 
Gerald Müllan
Schelleingasse 2/11
1040 Vienna, Austria
0043 699 11772506
gerald.muellan@gmail.com