I want to put som text into the fields in Doc2Form. So when your meet the form on the page the text could be "write your name here" in the name field, and when I set the marker in the field, the text disappears. I can't figure out how to get the text in.
Found this example but I'm stuck.
<input type="text" name="s" id="s" value="Write your name here" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/>
I know Doc2form dosn't show <input type="text"... But how.
chris, great link... in theory, could you use this to put a red outline around invalid fields as well after submit??? hmmm... i may investigate this and write a wiki topic... oh, if i only had more freetime.
Adding the red line though is an issue in IE (maybe just IE6... can't remember),The border css prop doesn't work on select/dropdowns. It should work with textboxes though. I'm sure there's a load of discussions on the web on this topic alone.
You may be best to surround each form element with <div class="formElement" /> and then add the red border to this.
How to put text into fields in Doc2Form
Hi there,
I want to put som text into the fields in Doc2Form.
So when your meet the form on the page the text could be "write your name here" in the name field, and when I set the marker in the field, the text disappears.
I can't figure out how to get the text in.
Found this example but I'm stuck.
<input type="text" name="s" id="s" value="Write your name here" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/>
I know Doc2form dosn't show <input type="text"... But how.
Could anyone help?
Kind regards
Palle
Hi Palle,
jQuery is your friend on this one. Check out http://www.dailycoding.com/Posts/default_text_fields_using_simple_jquery_trick.aspx
Cheers,
Chris
On a side note. Learn to use jQuery as it rocks. Any JS you write in jQuery will be some much easier, more robust and usually far more accessible.
Hi Chris,
Thank for qick replay. I'll look into it :)
Palle
chris, great link... in theory, could you use this to put a red outline around invalid fields as well after submit??? hmmm... i may investigate this and write a wiki topic... oh, if i only had more freetime.
Absolutely, you can edit any css property.
Adding the red line though is an issue in IE (maybe just IE6... can't remember),The border css prop doesn't work on select/dropdowns. It should work with textboxes though. I'm sure there's a load of discussions on the web on this topic alone.
You may be best to surround each form element with <div class="formElement" /> and then add the red border to this.
is working on a reply...