Force insert text into form text input field onload

Have a small problem with a cms whereby when i try to insert default text into an input text field using the “value” attribute it gets deleted. I was thinking to force insert the text in there when the page load with javascript but not sure exactly how…

<p><input name=“vericode” id=“vericode” value=“This text doesn’t display!!” type=“text” onclick=“value=‘’”/></p>

try

<p><input name=“vericode” id=“vericode” value=“This text doesn’t display!!” type=“text” onfocus=“value”/></p>

It works when I put it into dreamweaver and then preview in firefox browser. :slight_smile:

Doesn’t work for me on Mac FF, Opera or Safari…

Perhaps you would care to share with us some details about which CMS you’re having this issue with.

MODx using eForm snippet’s CAPTCHA feature.

http://wiki.modxcms.com/index.php/CAPTCHA

Wow, that’s the first time that MODx has been mentioned in this forum. The first time, ever.

I don’t know how to help you on your issue, but I suspect that the good people in the MODx Community Forums will be able to help you further.

First time? Sorry, but I don’t think so!

I’ve no doubt they will, I just need a quick fix of enforcing text in the input using javascript in the meantime.

From a brief look at MODx, it appears that it performs automatic validation of form values.

This indicates that your form values are clearing themself as a part of the way that MODx works.

I strongly suggest that you learn more about properly controlling MODx form validation, and selectively disabling that validation for things like the part you’re having trouble with, from people who know how MODx works.