SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast hotdiggity's Avatar
    Join Date
    Aug 2004
    Location
    Brisbane
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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>

  2. #2
    SitePoint Member
    Join Date
    Apr 2007
    Location
    Perth
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Flamingcow Design - Perth, WA

  3. #3
    SitePoint Enthusiast hotdiggity's Avatar
    Join Date
    Aug 2004
    Location
    Brisbane
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't work for me on Mac FF, Opera or Safari...

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Perhaps you would care to share with us some details about which CMS you're having this issue with.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Enthusiast hotdiggity's Avatar
    Join Date
    Aug 2004
    Location
    Brisbane
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MODx using eForm snippet's CAPTCHA feature.

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

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by hotdiggity View Post
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Enthusiast hotdiggity's Avatar
    Join Date
    Aug 2004
    Location
    Brisbane
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •