Re: adding extra javascript call in CheckBox
Hi all, i have to do same thing. I have to call an external javascript function on onClick method of the checkbox. i'm using a 1.2.6 version of apache wicket, and in this version the class CheckBox has method onComponentTag with final modifier. So i can't override this method. Is there any other way to do this? (naturally without change my apache wicket version ) Thanks in advance E. new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20339961.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Is AttributeModifier not available in 1.2.x? On Wed, Nov 5, 2008 at 6:25 AM, nickponico [EMAIL PROTECTED] wrote: Hi all, i have to do same thing. I have to call an external javascript function on onClick method of the checkbox. i'm using a 1.2.6 version of apache wicket, and in this version the class CheckBox has method onComponentTag with final modifier. So i can't override this method. Is there any other way to do this? (naturally without change my apache wicket version ) Thanks in advance E. new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20339961.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
What javascript do you want to put into your onclick handler? On Wed, Nov 5, 2008 at 6:39 AM, nickponico [EMAIL PROTECTED] wrote: Thank you for your reply. Yes there is the Attribute Modifier, but i don't think it can help me. I try to explain shortly the problem: I have to modify a css class of a specific div: the DIV can't be managed by wicket (with wicket id), but only on html. So i created a little javascript function that change the css class, and i would like to execute it when a user clicks on a CheckBox. Since i can't manage function (and div) by wicket... i have some difficulties to associate it an attributeModifier. right? or do i forget something? thanks jwcarman wrote: Is AttributeModifier not available in 1.2.x? -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20340173.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
I've inserted this simple function in head of html: script type=text/javascript function show() { document.getElementById(myDiv).setAttribute(class, visible); } /script /head and i'd like to execute this function on onlick... so somthing like: onlclick=show() This is a particular situation, but very important for my GUI. Thanks E. jwcarman wrote: What javascript do you want to put into your onclick handler? -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20340933.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
nickponico wrote: Thank you for your reply. Yes there is the Attribute Modifier, but i don't think it can help me. I try to explain shortly the problem: I have to modify a css class of a specific div: the DIV can't be managed by wicket (with wicket id), but only on html. What do you mean by that? Why you cannot add a WebMarkupConatiner to the div? And additionally if you do setOutputMarkupId(true) you could use the generated id to do what you wnat in a (generated) javaScript function. I do such tricks all the time... Ernesto * Este correo ha sido procesado por el antivirus del Grupo FCC. * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
So, why can't you use AttributeModifier to set the onclick text? On Wed, Nov 5, 2008 at 7:37 AM, nickponico [EMAIL PROTECTED] wrote: I've inserted this simple function in head of html: script type=text/javascript function show() { document.getElementById(myDiv).setAttribute(class, visible); } /script /head and i'd like to execute this function on onlick... so somthing like: onlclick=show() This is a particular situation, but very important for my GUI. Thanks E. jwcarman wrote: What javascript do you want to put into your onclick handler? -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20340933.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Ok... only now i've understood my mistake... I've had to use a WebmarkupContainer for my div and later use an Attribute Modifier. I didn't know WebMarkupContainer component usage. Thanks to all for replies. bye E. Ernesto Reinaldo Barreiro-3 wrote: Why you cannot add a WebMarkupConatiner to the div? -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20342436.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Do you get a JavaScript error? Maybe document.getElementById(myDiv).className=visible; will do the trick... Ernesto nickponico wrote: I've inserted this simple function in head of html: script type=text/javascript function show() { document.getElementById(myDiv).setAttribute(class, visible); } /script /head and i'd like to execute this function on onlick... so somthing like: onlclick=show() This is a particular situation, but very important for my GUI. Thanks E. jwcarman wrote: What javascript do you want to put into your onclick handler? * Este correo ha sido procesado por el antivirus del Grupo FCC. *
Re: adding extra javascript call in CheckBox
Thank you for your reply. Yes there is the Attribute Modifier, but i don't think it can help me. I try to explain shortly the problem: I have to modify a css class of a specific div: the DIV can't be managed by wicket (with wicket id), but only on html. So i created a little javascript function that change the css class, and i would like to execute it when a user clicks on a CheckBox. Since i can't manage function (and div) by wicket... i have some difficulties to associate it an attributeModifier. right? or do i forget something? thanks jwcarman wrote: Is AttributeModifier not available in 1.2.x? -- View this message in context: http://www.nabble.com/adding-extra-javascript-call-in-CheckBox-tp15318650p20340173.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Following example does almost what you want (if I didn;t get you wrong). ChangeColorPanel.html wicket:panel div span wicket:id=colorPanel style= width: 10px; height: 10px; background-color: red; nbsp;nbsp; /span span wicket:id=red onclick= Red /span span wicket:id=blue onclick= Blue /span span wicket:id=green onclick= Green /span /div /wicket:panel ChangeColorPanel.java import org.apache.wicket.AttributeModifier; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.AbstractReadOnlyModel; /** * @author EReinaldoB * */ public class ChangeColorPanel extends Panel { private static final long serialVersionUID = 1L; private WebMarkupContainer colorPanel; /** * @param id */ public ChangeColorPanel(String id) { super(id); colorPanel = new WebMarkupContainer(colorPanel); colorPanel.setOutputMarkupId(true); add(colorPanel); WebMarkupContainer red = new WebMarkupContainer(red); red.add(new AttributeModifier(onclick, new AbstractReadOnlyModelString() { private static final long serialVersionUID = 1L; @Override public String getObject() { String id = colorPanel.getMarkupId(); return document.getElementById(' + id + ').style.backgroundColor='red'; } })); add(red); WebMarkupContainer blue = new WebMarkupContainer(blue); blue.add(new AttributeModifier(onclick, new AbstractReadOnlyModelString() { private static final long serialVersionUID = 1L; @Override public String getObject() { String id = colorPanel.getMarkupId(); return document.getElementById(' + id + ').style.backgroundColor='blue'; } })); add(blue); WebMarkupContainer green = new WebMarkupContainer(green); green.add(new AttributeModifier(onclick, new AbstractReadOnlyModelString() { private static final long serialVersionUID = 1L; @Override public String getObject() { String id = colorPanel.getMarkupId(); return document.getElementById(' + id + ').style.backgroundColor='green'; } })); add(green); } } if you replace the first span by a div a the the later spans by check boxes and intead of modifying the style.backgroundColor you modify the 'className' to the css name you want, I guess this is what you want? This example works (I tested before posting it ;-) ) Best Ernesto nickponico wrote: Thank you for your reply. Yes there is the Attribute Modifier, but i don't think it can help me. I try to explain shortly the problem: I have to modify a css class of a specific div: the DIV can't be managed by wicket (with wicket id), but only on html. So i created a little javascript function that change the css class, and i would like to execute it when a user clicks on a CheckBox. Since i can't manage function (and div) by wicket... i have some difficulties to associate it an attributeModifier. right? or do i forget something? thanks jwcarman wrote: Is AttributeModifier not available in 1.2.x? * Este correo ha sido procesado por el antivirus del Grupo FCC. *
adding extra javascript call in CheckBox
Hi All, I was wondering if there's a way to add or decorate a javascript call in CheckBox? What I did was: new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } But it overrides the original onClick that Wicket is writing. Is there a way that I can decorate it so that I can add extra javaScript call in onClick without overriding the original click, like the buttons has this: protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() Thanks in advance and happy chinese new year! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
tag.put(onclick,executeSomething();+tag.getattributes().get(onclick)); -igor On Feb 6, 2008 10:39 AM, Beyonder Unknown [EMAIL PROTECTED] wrote: Hi All, I was wondering if there's a way to add or decorate a javascript call in CheckBox? What I did was: new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } But it overrides the original onClick that Wicket is writing. Is there a way that I can decorate it so that I can add extra javaScript call in onClick without overriding the original click, like the buttons has this: protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() Thanks in advance and happy chinese new year! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Another thing that is confusing to me is that, why is it that when I override the onComponentTag() the name attribute in the generated markup disappear. I'm just appending function in the onClick when I override onComponentTag(). Thoughts? Thanks, Wen Tong -- The only constant in life is change. - Original Message From: Beyonder Unknown [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 1:24:16 PM Subject: Re: adding extra javascript call in CheckBox Thanks Igor! I appreciate the prompt reply. Best, Wen Tong -- The only constant in life is change. - Original Message From: Igor Vaynberg [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 10:45:52 AM Subject: Re: adding extra javascript call in CheckBox tag.put(onclick,executeSomething();+tag.getattributes().get(onclick)); -igor On Feb 6, 2008 10:39 AM, Beyonder Unknown [EMAIL PROTECTED] wrote: Hi All, I was wondering if there's a way to add or decorate a javascript call in CheckBox? What I did was: new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } But it overrides the original onClick that Wicket is writing. Is there a way that I can decorate it so that I can add extra javaScript call in onClick without overriding the original click, like the buttons has this: protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() Thanks in advance and happy chinese new year! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
because you dont call super.oncomponenttag() -igor On Feb 6, 2008 2:14 PM, Beyonder Unknown [EMAIL PROTECTED] wrote: Another thing that is confusing to me is that, why is it that when I override the onComponentTag() the name attribute in the generated markup disappear. I'm just appending function in the onClick when I override onComponentTag(). Thoughts? Thanks, Wen Tong -- The only constant in life is change. - Original Message From: Beyonder Unknown [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 1:24:16 PM Subject: Re: adding extra javascript call in CheckBox Thanks Igor! I appreciate the prompt reply. Best, Wen Tong -- The only constant in life is change. - Original Message From: Igor Vaynberg [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 10:45:52 AM Subject: Re: adding extra javascript call in CheckBox tag.put(onclick,executeSomething();+tag.getattributes().get(onclick)); -igor On Feb 6, 2008 10:39 AM, Beyonder Unknown [EMAIL PROTECTED] wrote: Hi All, I was wondering if there's a way to add or decorate a javascript call in CheckBox? What I did was: new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } But it overrides the original onClick that Wicket is writing. Is there a way that I can decorate it so that I can add extra javaScript call in onClick without overriding the original click, like the buttons has this: protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() Thanks in advance and happy chinese new year! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Never mind, I noticed that it doesn't call the super.onComponentTag(). my bad. Wen Tong -- The only constant in life is change. - Original Message From: Beyonder Unknown [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 2:14:12 PM Subject: Re: adding extra javascript call in CheckBox Another thing that is confusing to me is that, why is it that when I override the onComponentTag() the name attribute in the generated markup disappear. I'm just appending function in the onClick when I override onComponentTag(). Thoughts? Thanks, Wen Tong -- The only constant in life is change. - Original Message From: Beyonder Unknown [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 1:24:16 PM Subject: Re: adding extra javascript call in CheckBox Thanks Igor! I appreciate the prompt reply. Best, Wen Tong -- The only constant in life is change. - Original Message From: Igor Vaynberg [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 10:45:52 AM Subject: Re: adding extra javascript call in CheckBox tag.put(onclick,executeSomething();+tag.getattributes().get(onclick)); -igor On Feb 6, 2008 10:39 AM, Beyonder Unknown [EMAIL PROTECTED] wrote: Hi All, I was wondering if there's a way to add or decorate a javascript call in CheckBox? What I did was: new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } But it overrides the original onClick that Wicket is writing. Is there a way that I can decorate it so that I can add extra javaScript call in onClick without overriding the original click, like the buttons has this: protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() Thanks in advance and happy chinese new year! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding extra javascript call in CheckBox
Thanks Igor! -- The only constant in life is change. - Original Message From: Igor Vaynberg [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 2:19:44 PM Subject: Re: adding extra javascript call in CheckBox because you dont call super.oncomponenttag() -igor On Feb 6, 2008 2:14 PM, Beyonder Unknown [EMAIL PROTECTED] wrote: Another thing that is confusing to me is that, why is it that when I override the onComponentTag() the name attribute in the generated markup disappear. I'm just appending function in the onClick when I override onComponentTag(). Thoughts? Thanks, Wen Tong -- The only constant in life is change. - Original Message From: Beyonder Unknown [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 1:24:16 PM Subject: Re: adding extra javascript call in CheckBox Thanks Igor! I appreciate the prompt reply. Best, Wen Tong -- The only constant in life is change. - Original Message From: Igor Vaynberg [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Wednesday, February 6, 2008 10:45:52 AM Subject: Re: adding extra javascript call in CheckBox tag.put(onclick,executeSomething();+tag.getattributes().get(onclick)); -igor On Feb 6, 2008 10:39 AM, Beyonder Unknown [EMAIL PROTECTED] wrote: Hi All, I was wondering if there's a way to add or decorate a javascript call in CheckBox? What I did was: new CheckBox(checkBox, new Model()) { protected void onComponentTag(ComponentTag tag) { tag.put(onclick,executeSomething();); } But it overrides the original onClick that Wicket is writing. Is there a way that I can decorate it so that I can add extra javaScript call in onClick without overriding the original click, like the buttons has this: protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() Thanks in advance and happy chinese new year! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]