PDA

View Full Version : OnFocus Event for Form Fields



AmaDee
04-26-2007, 05:04 PM
Hello my fair Vodalians,

I have a question in reference to this form http://www.designsbymapillar.com/form.html. As you can see, I have the names of the forms as the initial texts. I would like to know how to have those texts automatically erased when the filler clicks or tabs to each of the fields. I am aware that I have to have an OnFocus event set up, it's just that I've been toying with it for a while now with no success. Any help from any of you out there in Vadaland will be greatly appreciated.

navaldesign
04-26-2007, 07:55 PM
Click on the field that you want to have cleared when you place the mouse in. Select HTML, then click on "Inside Tag" and paste in the window to following code:



onFocus="if(this.value!='')this.value='';"


Please copy / paste the code from here, as what you see after the word "value" is NOT " but two ' .

AmaDee
04-27-2007, 09:36 PM
thanks, Naval.

AmaDee
04-27-2007, 09:40 PM
I just did the changes and all but the first field works. I guess it's the tabbing enables the command?

navaldesign
04-27-2007, 09:42 PM
Please provide a link to the form

AmaDee
04-27-2007, 09:47 PM
www.designsbymapillar.com/form.html (http://www.designsbymapillar.com/form.html)

navaldesign
04-27-2007, 09:57 PM
You already have another piece of javascript there (field "name") and they will not work both: onfocus="ShowObject('', 1);return false;"

AmaDee
04-27-2007, 10:15 PM
So right. That's from when I was messing around with the new onFocus event thingymajig. It's working great now, thanks.