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]

Reply via email to