To actually effect the text in the field, you need to do some DOM
manipulation, as so:
function setFieldValue(fieldId, text)
{
var inputField = document.getElementById(fieldId);
if (inputField != null)
{
inputField.value = text;
}
};
Then you assign the handler to whatever event(s) you'd like:
writer.writeAttribute(
"onfocus", "setFieldValue('fieldId', 'text')", null);
Or something very close to that (I'm not sure how the attribute would
come out in the response). Give it a try. One man's opinion.
Mike....
--- Jurgen Lust <[EMAIL PROTECTED]> wrote:
> Seems to me like it's a simple onFocus, onBlur kind of trick. We have
> a
> search box component at Ghent university that changes the background
> color
> of the inputText that way:
> These lines in the renderer are all it takes:
>
> writer.writeAttribute(
> "onfocus", "this.style.background='#fff';", null
> );
> writer.writeAttribute(
> "onblur", "this.style.background='#ECEFF8';", null
> );
>
>
> Jurgen
>
> 2006/5/10, Mike Kienenberger <[EMAIL PROTECTED]>:
> >
> > I've been asked to add a "helper text" effect like what we see on
> the
> > MyFaces wiki:
> >
> > http://wiki.apache.org/myfaces/
> >
> > See how it's got the word "Search" in the search box which
> disappears
> > as soon as you type something in? That's what I need.
> >
> > Sadly, MoinMoin is GNU GPL licensed, so I don't dare look at the
> > javascript to see how it's done, and my javascript skill is limited
> to
> > what I can cut and paste off someone else's site :)
> >
> > Seems like this would be a cool addition to t:inputText.
> >
> > -Mike
> >
>