I want a basic:
<input type="text" />
And I would like the default value to clear when the user puts in a value (kinda like this). It would be ideal if the default value returned onBlur.
I don’t want the default value to be submitted if they leave it and click submit.
I’m generating the form using Zend, and imagine my solution can fit entirely into a Zend Form Decorator.
I can’t find any existing ones, so I ask:
Do you have said decorator? Or something that will help me make one?
Ok, I’ve built a decorator which allows me to implement the jquery plugin Ololo posted.
It checks to see if the element has a Label set, and if it does, defaults to that:
It allows me to define a default value in the form object (using setLabel).
And all I need to do then is ensure that query and plugin are included on the page, and this piece of code:
Then in the template, I can display the object like this: