[Tobago] f:ajax inside tc:in event="keyup"

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Tobago] f:ajax inside tc:in event="keyup"

jfrm.maurel@gmail.com

Hi,

I would like to check whether a user entry is a valid e-mail address
each time a key is pressed.

When I use f:ajax with event="keyup" inside tc:in, Tobago complains that
this event is not valid. It seems like this event is not implemented.

   <tc:in id="username" value="#{loginController.username}" label="User"
focus="true">
    <f:ajax event="keyup" listener="#{loginController.checkMel}" />
   </tc:in>


Is there a workaround for this ?

Regards.

--
Jean-François MAUREL
PIMECA
http://www.pimeca.com

Reply | Threaded
Open this post in threaded view
|

Re: [Tobago] f:ajax inside tc:in event="keyup"

Dennis Kieselhorst-2
Hi,

the change event should work for your usecase. You'll find a sample at
the bottom of the page:
http://tobago-vm.apache.org/demo-4-release/content/20-component/010-input/10-in/in.xhtml

Regards
Dennis
Reply | Threaded
Open this post in threaded view
|

Re: [Tobago] f:ajax inside tc:in event="keyup"

Dennis Kieselhorst-2
Am 20.08.2018 um 18:43 schrieb [hidden email]:

>
> Hi,
>
> Le 19/08/2018 à 21:58, Dennis Kieselhorst a écrit :
>> the change event should work for your usecase.
>
> Thank you for your answer. If I understand well the event will be fired
> only when the component looses focus with change. I would like to send
> it before if possible to capture the user error as soon as possible.
>
> Regards.
>

I see, I'm not sure if this is really the intended behaviour.

@Udo, Henning what do you think?

Cheers
Dennis
Reply | Threaded
Open this post in threaded view
|

Re: [Tobago] f:ajax inside tc:in event="keyup"

Volker Weber-5
Hi Dennis,

Am Mo., 20. Aug. 2018 um 18:50 Uhr schrieb Dennis Kieselhorst <
[hidden email]>:

>
> I see, I'm not sure if this is really the intended behaviour.
>
> @Udo, Henning what do you think?
>
> Cheers
> Dennis
>

I'm not sure about your question, is it about the behavior of the
"onchange" event? I think this works like intended. It makes no sense to
fire this event at a text input on every keypress, even if each keypress
changes the content.

Regards,
  Volker



--
inexso - information exchange solutions GmbH
Ofener Straße 30 | 26121 Oldenburg
www.inexso.de
Reply | Threaded
Open this post in threaded view
|

Re: [Tobago] f:ajax inside tc:in event="keyup"

Henning Nöth
Hi,

Tobago doesn't currently support the 'keyup' event.
We plan to implement this in the future but in the meantime you have to
use the 'change' event.

If 'change' is absolutely not an option, the only workaround I see is a
JavaScript-Hack.
You can put a listener on 'keyup' and trigger the 'change' event.
Something like this:

function() {
  var $inputAjaxField = jQuery("#page\\:mainForm\\:inputAjax\\:\\:field");
  $inputAjaxField.on('keyup', function () {
    $inputAjaxField.trigger('change');
  });
};

But I'm not sure what side effects will occur...


Regards,
Henning


Am 21.08.18 um 09:26 schrieb Volker Weber:

> Hi Dennis,
>
> Am Mo., 20. Aug. 2018 um 18:50 Uhr schrieb Dennis Kieselhorst <
> [hidden email]>:
>
>>
>> I see, I'm not sure if this is really the intended behaviour.
>>
>> @Udo, Henning what do you think?
>>
>> Cheers
>> Dennis
>>
>
> I'm not sure about your question, is it about the behavior of the
> "onchange" event? I think this works like intended. It makes no sense to
> fire this event at a text input on every keypress, even if each keypress
> changes the content.
>
> Regards,
>   Volker
>
>
>