SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Location
    Scotland
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible to prevent highlighting text within a text field?

    I am using a calendar control based on the one at Brainjar.com. I have made the text field into which the date is inserted readonly. The problem with this is that if a user attempts to change the date manually by deleting part of the highlighted text, the browser goes back one page.

    I want to force the user to use the calendar control and not input text directly into the textfield- readonly is not enough as the text can still be highlighted and then causes problems if the user attempts to delete.

    Any suggestions.

    Thanks

    Gordon

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    disabled = true ?

  3. #3
    SitePoint Member
    Join Date
    Jul 2002
    Location
    Scotland
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, please ignore-

    It doesn't matter whether highlighted or not, doesn't matter if my brain is engaged or not

    Gordon

  4. #4
    SitePoint Member
    Join Date
    Jul 2002
    Location
    Scotland
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the response jofa- that might actually be quite useful.

    cheers

  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LoadModule brain ?

  6. #6
    SitePoint Member
    Join Date
    Jul 2002
    Location
    Scotland
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Parse error: parse error, expecting `A_BRAIN' or `$INTELLIGENCE' in
    c:\brain\programming\dumbass


  7. #7
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by jofa
    disabled = true ?
    Doesn't that prevent the data in that field from being sent with the form data package as well?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  8. #8
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by beetle
    Doesn't that prevent the data in that field from being sent with the form data package as well?
    Yes, you have to use a hidden field and some javascript to include the value in the posted form data

  9. #9
    SitePoint Addict
    Join Date
    Mar 2001
    Location
    the windy city
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could also try onFocus=this.blur()
    Goals are dreams with deadlines
    -------------------------------------
    Nimlok Trade Show Displays Booths and Exhibits

  10. #10
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by valeria_vi
    you could also try onFocus=this.blur()
    Or you could try
    onmouseover="this.style.left = parseInt(this.style.left) + parseInt(this.style.width);"


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
  •