You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by rebecca <ri...@gmail.com> on 2011/08/18 07:30:21 UTC

onchane not working with jquery numeric plugin

hello,

I'm using wicket 1.4.16. 
I have a simple text field component on a phone number panel.
I used TexoTela's jquery plugin "jquery.numeric" to enable only numeric
input to the text field. 
I added it in a <script> block in the html file of this phone number panel:

$(function(){
    $('.numericPhone').numeric();
}

Everything worked fine.

Than I added AjaxFormComponentUpdatingBehavior("onchange") to this number
text field.
The onchage was not called (ie - it didn't get into onUpdate/onError).

Only when i removed the use of the numeric plugin - the ajax worked.

Do you have an idea what am i doing wrong?

Thanks
Rebecca


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3751788.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: onchane not working with jquery numeric plugin

Posted by rebecca <ri...@gmail.com>.
I wish things were dependent on what i need (it's a business requirement) :-)

About your example - I don't want to show a message on parse error, I just
don't want to let the user to input characters that are not numbers.


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3752224.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: onchane not working with jquery numeric plugin

Posted by Martin Grigorov <mg...@apache.org>.
The question is: do you really need this client side validation ?
If YES then override getAjaxCallDecorator of the
AjaxFormComponentUpdatingBehavior and do something like:

onDecorateScript(String script) {
  return "if (parseInt(this.value) !== NaN) { " + script + " }";

}

On Thu, Aug 18, 2011 at 12:00 PM, rebecca <ri...@gmail.com> wrote:
> Hi Martin,
>
> I checked the plug-in js file and did not find use of the functions you
> mentioned.
> Anyways, even with my poor JS knowledge i understood that there is a clash
> with the plug-in.
>
> Can you recommend of another package that i can use for client side numeric
> restriction on text field.
> Is there a wicket way to do it?
>
> Thanks a lot
> Rebecca
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3752095.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: onchane not working with jquery numeric plugin

Posted by rebecca <ri...@gmail.com>.
Hi Martin,

I checked the plug-in js file and did not find use of the functions you
mentioned.
Anyways, even with my poor JS knowledge i understood that there is a clash
with the plug-in.

Can you recommend of another package that i can use for client side numeric
restriction on text field.
Is there a wicket way to do it?

Thanks a lot
Rebecca

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3752095.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: onchane not working with jquery numeric plugin

Posted by Martin Grigorov <mg...@apache.org>.
It sounds like TexoTela plugin kills the JavaScript event, i.e. it
does something like: event.preventDefault(), event.stopPropagation().
Better check the plugin code and see what happens.

On Thu, Aug 18, 2011 at 8:30 AM, rebecca <ri...@gmail.com> wrote:
> hello,
>
> I'm using wicket 1.4.16.
> I have a simple text field component on a phone number panel.
> I used TexoTela's jquery plugin "jquery.numeric" to enable only numeric
> input to the text field.
> I added it in a <script> block in the html file of this phone number panel:
>
> $(function(){
>    $('.numericPhone').numeric();
> }
>
> Everything worked fine.
>
> Than I added AjaxFormComponentUpdatingBehavior("onchange") to this number
> text field.
> The onchage was not called (ie - it didn't get into onUpdate/onError).
>
> Only when i removed the use of the numeric plugin - the ajax worked.
>
> Do you have an idea what am i doing wrong?
>
> Thanks
> Rebecca
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3751788.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: onchange not working with jquery numeric plugin

Posted by Rodrigo Heffner <ro...@gmail.com>.
I mean that the numeric() function may have logic that changes / overrides
wicket's "onchange" calls, either the numeric() function works or (if
removed) the AjaxFormComponentUpdatingBehavior works.

On Thu, Aug 18, 2011 at 9:03 AM, rebecca <ri...@gmail.com> wrote:

> The ajax did work with "onkeyup" but i really need the "onchange" event.
> What do you mean by "the jquery function must be binded to the same
> behaviour "?
>
> Thanks
> Rebecca
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3752004.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Rodrigo H M Bezerra

Re: onchange not working with jquery numeric plugin

Posted by rebecca <ri...@gmail.com>.
The ajax did work with "onkeyup" but i really need the "onchange" event.
What do you mean by "the jquery function must be binded to the same
behaviour "?

Thanks
Rebecca

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3752004.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: onchane not working with jquery numeric plugin

Posted by Rodrigo Heffner <ro...@gmail.com>.
Hi Rebecca,

I'm quite new to wicket but I've had a similar problem before. I would
imagine that the jquery function must be binded to the same behaviour
(onchange) that you're using in your code.

If you change your code to be triggered "onblur", does this happen as well?
On 18 Aug 2011 06:31, "rebecca" <ri...@gmail.com> wrote:
> hello,
>
> I'm using wicket 1.4.16.
> I have a simple text field component on a phone number panel.
> I used TexoTela's jquery plugin "jquery.numeric" to enable only numeric
> input to the text field.
> I added it in a <script> block in the html file of this phone number
panel:
>
> $(function(){
> $('.numericPhone').numeric();
> }
>
> Everything worked fine.
>
> Than I added AjaxFormComponentUpdatingBehavior("onchange") to this number
> text field.
> The onchage was not called (ie - it didn't get into onUpdate/onError).
>
> Only when i removed the use of the numeric plugin - the ajax worked.
>
> Do you have an idea what am i doing wrong?
>
> Thanks
> Rebecca
>
>
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/onchane-not-working-with-jquery-numeric-plugin-tp3751788p3751788.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>