Re: How to implement hint text in a TextField?
I have one last small problem with this topic which is that I don't see any particularly elegant place to clear the hint text from this TextField when the form is submitted. I've considered adding JavaScript to the Form to implement the onSubmit handler. I don't like this case because then JavaScript pertaining to this particular Behavior is now in an additional location, on the form. The other idea I've considered is to discard the value in the Handler. This is slightly more elegant, but I still feel like the Behavior has crept out into other classes. Is there a more elegant place that I've overlooked? Thanks, Nate On Fri, May 9, 2008 at 5:22 PM, nate roe [EMAIL PROTECTED] wrote: Oh, yeah I see IBehavior.rendered(Component) that is called when the component has been rendered. Great, thanks a lot! Nate On Fri, May 9, 2008 at 5:04 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i meant in the behavior. does it have something like rendered() or afterrender() ? somewhere so you can do getcomponent().getresponse().write(script.../script); -igor On Fri, May 9, 2008 at 5:02 PM, nate roe [EMAIL PROTECTED] wrote: In Component, do you mean? I see onRender(MarkupStream) .. do I need to find the after component part by using the MarkupStream? Thank you, Nate On Fri, May 9, 2008 at 4:51 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: 1.2 doesnt have it, so just override onrenderaftercomponent and do it there -igor On Fri, May 9, 2008 at 4:50 PM, nate roe [EMAIL PROTECTED] wrote: Hrm. The IHeaderResponse interface is new in 1.3 but for a little while longer I must use Wicket 1.2. How does one accomplish response.renderOnDomReadyScript() in 1.2? I don't see any method similar to renderOnDomReadyScript on the Response class. Thanks! Nate On Fri, May 9, 2008 at 4:35 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to implement hint text in a TextField?
How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe
Re: How to implement hint text in a TextField?
i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to implement hint text in a TextField?
Hrm. The IHeaderResponse interface is new in 1.3 but for a little while longer I must use Wicket 1.2. How does one accomplish response.renderOnDomReadyScript() in 1.2? I don't see any method similar to renderOnDomReadyScript on the Response class. Thanks! Nate On Fri, May 9, 2008 at 4:35 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to implement hint text in a TextField?
1.2 doesnt have it, so just override onrenderaftercomponent and do it there -igor On Fri, May 9, 2008 at 4:50 PM, nate roe [EMAIL PROTECTED] wrote: Hrm. The IHeaderResponse interface is new in 1.3 but for a little while longer I must use Wicket 1.2. How does one accomplish response.renderOnDomReadyScript() in 1.2? I don't see any method similar to renderOnDomReadyScript on the Response class. Thanks! Nate On Fri, May 9, 2008 at 4:35 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - 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: How to implement hint text in a TextField?
In Component, do you mean? I see onRender(MarkupStream) .. do I need to find the after component part by using the MarkupStream? Thank you, Nate On Fri, May 9, 2008 at 4:51 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: 1.2 doesnt have it, so just override onrenderaftercomponent and do it there -igor On Fri, May 9, 2008 at 4:50 PM, nate roe [EMAIL PROTECTED] wrote: Hrm. The IHeaderResponse interface is new in 1.3 but for a little while longer I must use Wicket 1.2. How does one accomplish response.renderOnDomReadyScript() in 1.2? I don't see any method similar to renderOnDomReadyScript on the Response class. Thanks! Nate On Fri, May 9, 2008 at 4:35 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - 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: How to implement hint text in a TextField?
i meant in the behavior. does it have something like rendered() or afterrender() ? somewhere so you can do getcomponent().getresponse().write(script.../script); -igor On Fri, May 9, 2008 at 5:02 PM, nate roe [EMAIL PROTECTED] wrote: In Component, do you mean? I see onRender(MarkupStream) .. do I need to find the after component part by using the MarkupStream? Thank you, Nate On Fri, May 9, 2008 at 4:51 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: 1.2 doesnt have it, so just override onrenderaftercomponent and do it there -igor On Fri, May 9, 2008 at 4:50 PM, nate roe [EMAIL PROTECTED] wrote: Hrm. The IHeaderResponse interface is new in 1.3 but for a little while longer I must use Wicket 1.2. How does one accomplish response.renderOnDomReadyScript() in 1.2? I don't see any method similar to renderOnDomReadyScript on the Response class. Thanks! Nate On Fri, May 9, 2008 at 4:35 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to implement hint text in a TextField?
Oh, yeah I see IBehavior.rendered(Component) that is called when the component has been rendered. Great, thanks a lot! Nate On Fri, May 9, 2008 at 5:04 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i meant in the behavior. does it have something like rendered() or afterrender() ? somewhere so you can do getcomponent().getresponse().write(script.../script); -igor On Fri, May 9, 2008 at 5:02 PM, nate roe [EMAIL PROTECTED] wrote: In Component, do you mean? I see onRender(MarkupStream) .. do I need to find the after component part by using the MarkupStream? Thank you, Nate On Fri, May 9, 2008 at 4:51 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: 1.2 doesnt have it, so just override onrenderaftercomponent and do it there -igor On Fri, May 9, 2008 at 4:50 PM, nate roe [EMAIL PROTECTED] wrote: Hrm. The IHeaderResponse interface is new in 1.3 but for a little while longer I must use Wicket 1.2. How does one accomplish response.renderOnDomReadyScript() in 1.2? I don't see any method similar to renderOnDomReadyScript on the Response class. Thanks! Nate On Fri, May 9, 2008 at 4:35 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i havent had to do this but something like this might work: class hint extends abstractbehavior { private final imodelstring hint; onbind(component c) { c.setoutputmarkupid(true); } ondetach() { hint.detach(); super.ondetach(); } renderhead(response) { // init textfield with hint response.renderondomreadyscript(var e=document.getelementbyid('+getcomponent.getmarkupid()+'); e.value='+hint.getobject()+';e.style['color']='gray';); } oncomponenttag(tag) { tag.put(onfocus, if (this.value='+hint.getobject()+') { this.value=''; this.style['color']='black;'}); } } then just textfield.add(new hint(new modelstring(search))); -igor On Fri, May 9, 2008 at 4:25 PM, nate roe [EMAIL PROTECTED] wrote: How would one implement hint text on a text field in Wicket? By hint text I mean an empty TextField has greyed out text in it to indicate its purpose, and gets cleared onFocus?) Thanks, Nate Roe - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]