Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Palle Hansen 143 posts 396 karma points
    Aug 13, 2009 @ 19:16
    Palle Hansen
    0

    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

     

  • Chris Koiak 700 posts 2626 karma points
    Aug 13, 2009 @ 19:31
    Chris Koiak
    0

    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

  • Chris Koiak 700 posts 2626 karma points
    Aug 13, 2009 @ 19:33
    Chris Koiak
    102

    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.

  • Palle Hansen 143 posts 396 karma points
    Aug 13, 2009 @ 19:40
    Palle Hansen
    0

    Hi Chris,

    Thank for qick replay. I'll look into it :)

    Palle

  • bob baty-barr 1180 posts 1294 karma points MVP
    Aug 13, 2009 @ 22:09
    bob baty-barr
    0

    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.

  • Chris Koiak 700 posts 2626 karma points
    Aug 13, 2009 @ 22:21
    Chris Koiak
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft