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 imodel<string> 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 model<string>("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]