Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
hi, in your example, there aren't behaviours, or where are they? On Thu, Sep 24, 2009 at 5:54 AM, jWeekend jweekend_for...@cabouge.comwrote: Chris, The fact that you've chosen to use Wicket probably shows there's not so much danger of that! To better see what's going on, try the snippet below in the project you attached // ... mark t2 final and // append this to your BasePage constructor con.add(t2.setOutputMarkupId(true)); add(new AjaxLink(toggleVisiblity){ @Override public void onClick(AjaxRequestTarget target) { t2.setVisible(!t2.isVisible()); target.addComponent(t2); } }); Fix your BasePage.html accordingly eg, add an anchor to the body with wicket:id=toggleVisiblity. When you fire up your app, click on that link once and you can use FireBug in Firefox to verify that the onblur code you wanted is indeed in place. Is that the effect you were after? Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com PS Nabble is not showing posts to our list (I think it's pointing back to SourceForge again!) so I am replying here in case you need a solution quickly and this happens to be the actual issue you are faced with! maybe i'm to stupid to understand what you mean. so please provide an example. thx -Ursprüngliche Nachricht- Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com] Gesendet: Do 24.09.2009 02:45 An: users@wicket.apache.org Betreff: AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor - Hide quoted text - well, it makes no sense to add the javascript to another container. how should i validate the textfields if the javascript points to a different component? or could you give me an example? -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 02:32 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor i meant add the javascript to a container that is visible. components that are not visible do not render their javascript, it wouldnt make any sense for them to do otherwise. -igor On Wed, Sep 23, 2009 at 5:16 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';}
FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
Hi all, ich have a component (textfield) with an FXValidationAjaxHandler. If i set this component in pageconstructor to visible(false) then the needed javascript code for validation is not contributed to pageheader. if set to visible(true) all is fine. does anyone had the same problem and if so, is there a workaround available? greets chris snippet: ... pComponent.add(new FXValidationAjaxHandler(pFXJavascriptEvent)); this.pComponent.setOutputMarkupPlaceholderTag(true); this.pComponent.setOutputMarkupId(true) this.pComponent.setVisible(false); // no javascript is added //this.pComponent.setVisible(true); // javascript is added form.add(this.pComponent); ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
javascript contributions do not show up for components that are not visible, add it to a visible component instead. -igor On Wed, Sep 23, 2009 at 7:15 AM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi all, ich have a component (textfield) with an FXValidationAjaxHandler. If i set this component in pageconstructor to visible(false) then the needed javascript code for validation is not contributed to pageheader. if set to visible(true) all is fine. does anyone had the same problem and if so, is there a workaround available? greets chris snippet: ... pComponent.add(new FXValidationAjaxHandler(pFXJavascriptEvent)); this.pComponent.setOutputMarkupPlaceholderTag(true); this.pComponent.setOutputMarkupId(true) this.pComponent.setVisible(false); // no javascript is added //this.pComponent.setVisible(true); // javascript is added form.add(this.pComponent); ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
Hi, first thanks for reply. Well, it's not possible to add it to a visible component. Let me explain. I have 2 custom panels and depending on the selection in a dropdownchoice the corresponding panel gets visible or hidden. Because one of these panels need to be invisible on page construction (so not both are showing up) i need to set it invisible. If i then select it in the dropdownchoice i gets visible. And now the problem begins. Cause of the initial invisibility the needed javascript code for validation of the panel fields isn't injected. How can i workaround this? Thanks in advance chris -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Mi 23.09.2009 19:20 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor javascript contributions do not show up for components that are not visible, add it to a visible component instead. -igor On Wed, Sep 23, 2009 at 7:15 AM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi all, ich have a component (textfield) with an FXValidationAjaxHandler. If i set this component in pageconstructor to visible(false) then the needed javascript code for validation is not contributed to pageheader. if set to visible(true) all is fine. does anyone had the same problem and if so, is there a workaround available? greets chris snippet: ... pComponent.add(new FXValidationAjaxHandler(pFXJavascriptEvent)); this.pComponent.setOutputMarkupPlaceholderTag(true); this.pComponent.setOutputMarkupId(true) this.pComponent.setVisible(false); // no javascript is added //this.pComponent.setVisible(true); // javascript is added form.add(this.pComponent); ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
put the two panels into a parent container that is always visible. -igor On Wed, Sep 23, 2009 at 1:37 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi, first thanks for reply. Well, it's not possible to add it to a visible component. Let me explain. I have 2 custom panels and depending on the selection in a dropdownchoice the corresponding panel gets visible or hidden. Because one of these panels need to be invisible on page construction (so not both are showing up) i need to set it invisible. If i then select it in the dropdownchoice i gets visible. And now the problem begins. Cause of the initial invisibility the needed javascript code for validation of the panel fields isn't injected. How can i workaround this? Thanks in advance chris -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Mi 23.09.2009 19:20 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor javascript contributions do not show up for components that are not visible, add it to a visible component instead. -igor On Wed, Sep 23, 2009 at 7:15 AM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi all, ich have a component (textfield) with an FXValidationAjaxHandler. If i set this component in pageconstructor to visible(false) then the needed javascript code for validation is not contributed to pageheader. if set to visible(true) all is fine. does anyone had the same problem and if so, is there a workaround available? greets chris snippet: ... pComponent.add(new FXValidationAjaxHandler(pFXJavascriptEvent)); this.pComponent.setOutputMarkupPlaceholderTag(true); this.pComponent.setOutputMarkupId(true) this.pComponent.setVisible(false); // no javascript is added //this.pComponent.setVisible(true); // javascript is added form.add(this.pComponent); ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';} if (type=='valid'){ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(0) dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(200) }else{ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(0) ; dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(200) ; } } /script /head body span wicket:id=container input id=txt11 onblur=javascript:var wcall=wicketAjaxGet('?wicket:interface=:0:container:txt1::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=trueamp;container:txt1=' + this.value, function() { }, function() { });return !wcall; name=container:txt1 widgetId=txt11 value= type=text wicket:id=txt1/ input id=txt22 style=display:none/input /span /body /html -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 00:06 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor put the two panels into a parent container that is always visible. -igor On Wed, Sep 23, 2009 at 1:37 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi, first thanks for reply. Well, it's not possible to add it to a visible component. Let me explain. I have 2 custom panels and depending on the selection in a dropdownchoice the corresponding panel gets visible or hidden. Because one of these panels need to be invisible on page construction (so not both are showing up) i need to set it invisible. If i then select it in the dropdownchoice i gets visible. And now the problem begins. Cause of the initial invisibility the needed javascript code for validation of the panel fields isn't injected. How can i workaround this? Thanks in advance chris -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Mi 23.09.2009 19:20 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor javascript contributions do not show up for components that are not visible, add it to a visible component instead. -igor On Wed, Sep 23, 2009 at
Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
i meant add the javascript to a container that is visible. components that are not visible do not render their javascript, it wouldnt make any sense for them to do otherwise. -igor On Wed, Sep 23, 2009 at 5:16 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';} if (type=='valid'){ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(0) dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(200) }else{ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(0) ; dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(200) ; } } /script /head body span wicket:id=container input id=txt11 onblur=javascript:var wcall=wicketAjaxGet('?wicket:interface=:0:container:txt1::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=trueamp;container:txt1=' + this.value, function() { }, function() { });return !wcall; name=container:txt1 widgetId=txt11 value= type=text wicket:id=txt1/ input id=txt22 style=display:none/input /span /body /html -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 00:06 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor put the two panels into a parent container that is always visible. -igor On Wed, Sep 23, 2009 at 1:37 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi, first thanks for reply. Well, it's not possible to add it to a visible component. Let me explain. I have 2 custom panels and depending on the selection in a dropdownchoice the corresponding panel gets visible or hidden. Because one of these panels need to be invisible on page construction (so not both are showing up) i need to set it invisible. If i then select it in the dropdownchoice i gets visible. And now the problem begins. Cause of the initial invisibility the needed javascript code for validation of the panel fields isn't injected. How can i workaround this? Thanks in advance chris -Ursprüngliche Nachricht- Von: Igor Vaynberg
AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
well, it makes no sense to add the javascript to another container. how should i validate the textfields if the javascript points to a different component? or could you give me an example? -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 02:32 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor i meant add the javascript to a container that is visible. components that are not visible do not render their javascript, it wouldnt make any sense for them to do otherwise. -igor On Wed, Sep 23, 2009 at 5:16 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';} if (type=='valid'){ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(0) dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(200) }else{ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(0) ; dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(200) ; } } /script /head body span wicket:id=container input id=txt11 onblur=javascript:var wcall=wicketAjaxGet('?wicket:interface=:0:container:txt1::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=trueamp;container:txt1=' + this.value, function() { }, function() { });return !wcall; name=container:txt1 widgetId=txt11 value= type=text wicket:id=txt1/ input id=txt22 style=display:none/input /span /body /html -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 00:06 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor put the two panels into a parent container that is always visible. -igor On Wed, Sep 23, 2009 at 1:37 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: Hi, first thanks for reply. Well, it's not possible to add it to a visible component. Let me explain. I have 2 custom panels and depending on the selection in a dropdownchoice the corresponding panel gets visible or hidden. Because
AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
maybe i'm to stupid to understand what you mean. so please provide an example. thx -Ursprüngliche Nachricht- Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com] Gesendet: Do 24.09.2009 02:45 An: users@wicket.apache.org Betreff: AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor well, it makes no sense to add the javascript to another container. how should i validate the textfields if the javascript points to a different component? or could you give me an example? -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 02:32 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor i meant add the javascript to a container that is visible. components that are not visible do not render their javascript, it wouldnt make any sense for them to do otherwise. -igor On Wed, Sep 23, 2009 at 5:16 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';} if (type=='valid'){ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(0) dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(200) }else{ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(0) ; dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(200) ; } } /script /head body span wicket:id=container input id=txt11 onblur=javascript:var wcall=wicketAjaxGet('?wicket:interface=:0:container:txt1::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=trueamp;container:txt1=' + this.value, function() { }, function() { });return !wcall; name=container:txt1 widgetId=txt11 value= type=text wicket:id=txt1/ input id=txt22 style=display:none/input /span /body /html -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 00:06 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor put the two panels into a parent container that
Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
Why validate the input on a textfield that isn't displayed to the user? -- Jeremy Thomerson http://www.wickettraining.com On Wed, Sep 23, 2009 at 7:45 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: well, it makes no sense to add the javascript to another container. how should i validate the textfields if the javascript points to a different component? or could you give me an example? -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 02:32 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor i meant add the javascript to a container that is visible. components that are not visible do not render their javascript, it wouldnt make any sense for them to do otherwise. -igor On Wed, Sep 23, 2009 at 5:16 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';} if (type=='valid'){ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(0) dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(200) }else{ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(0) ; dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#fc8682'), 200).play(200) ; } } /script /head body span wicket:id=container input id=txt11 onblur=javascript:var wcall=wicketAjaxGet('?wicket:interface=:0:container:txt1::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=trueamp;container:txt1=' + this.value, function() { }, function() { });return !wcall; name=container:txt1 widgetId=txt11 value= type=text wicket:id=txt1/ input id=txt22 style=display:none/input /span /body /html -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 00:06 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor put the two panels into a parent container that is
re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor
Chris, The fact that you've chosen to use Wicket probably shows there's not so much danger of that! To better see what's going on, try the snippet below in the project you attached // ... mark t2 final and // append this to your BasePage constructor con.add(t2.setOutputMarkupId(true)); add(new AjaxLink(toggleVisiblity){ @Override public void onClick(AjaxRequestTarget target) { t2.setVisible(!t2.isVisible()); target.addComponent(t2); } }); Fix your BasePage.html accordingly eg, add an anchor to the body with wicket:id=toggleVisiblity. When you fire up your app, click on that link once and you can use FireBug in Firefox to verify that the onblur code you wanted is indeed in place. Is that the effect you were after? Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com PS Nabble is not showing posts to our list (I think it's pointing back to SourceForge again!) so I am replying here in case you need a solution quickly and this happens to be the actual issue you are faced with! maybe i'm to stupid to understand what you mean. so please provide an example. thx -Ursprüngliche Nachricht- Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com] Gesendet: Do 24.09.2009 02:45 An: users@wicket.apache.org Betreff: AW: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor - Hide quoted text - well, it makes no sense to add the javascript to another container. how should i validate the textfields if the javascript points to a different component? or could you give me an example? -Ursprüngliche Nachricht- Von: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Gesendet: Do 24.09.2009 02:32 An: users@wicket.apache.org Betreff: Re: FXValidationAjaxHandler - Javascript not added if component is set visible(false) in page constructor i meant add the javascript to a container that is visible. components that are not visible do not render their javascript, it wouldnt make any sense for them to do otherwise. -igor On Wed, Sep 23, 2009 at 5:16 PM, Giambalvo, Christian christian.giamba...@excelsisnet.com wrote: i'm sorry, but doesn't work. i attached a simple project. i added the needed components to a webmarkupcontainer. instead of panels this time i used requiredtextfields to keep it as simple as possible. one textfield is visible the other invisible. here is the generated markup: ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleWicket Demo/title link rel=stylesheet type=text/css href=/css/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/debug!--/*--![CDATA[/*!--*/ var djConfig = {}; djConfig.isDebug = true; djConfig.parseWidgets = false; djConfig.searchIds = [] /*--]]*//script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior/dojo-0.4/dojo.js/script script type=text/javascript src=resources/org.wicketstuff.dojo.AbstractRequireDojoBehavior/dojo-wicket/dojoWicket.js/script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/namespaces/wicketstuff!--/*--![CDATA[/*!--*/ dojo.registerModulePath(wicketstuff, ../../../resources/org.wicketstuff.dojo.AbstractDefaultDojoBehavior); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractDefaultDojoBehavior/consoleDebug!--/*--![CDATA[/*!--*/ dojo.require(dojo.debug.console); dojo.require(dojo.widget.Tree); /*--]]*//script script type=text/javascript id=org.wicketstuff.dojo.AbstractRequireDojoBehavior!--/*--![CDATA[/*!--*/ dojo.require(dojo.lfx.*); dojo.require(dojo.gfx.*); dojo.require(dojo.html.*); /*--]]*//script script type=text/javascript id=txt11DojoParse!--/*--![CDATA[/*!--*/ djConfig.searchIds.push(txt11); /*--]]*//script script language='JavaScript' type='text/javascript' var txt11_first = false; function txt11_validate(type) { with(dojo.byId('txt11').style){backgroundColor = '#FFF';} if (type=='valid'){ dojo.lfx.html.highlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'), 200).play(0) dojo.lfx.html.unhighlight('txt11', dojo.gfx.color.hex2rgb('#98c27d'),