Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts

    checkboxes and readonly

    Hello,

    I need a checkbox to appear that doesnt allow the user to check it and uncheck it but still passes the value across.

    Using the disabled attribute means the user cannot check and uncheck but the value doesnt pass across, and using the readonly attribute passes the value across but the user can still check and uncheck it.

    Can anyone provide an attribute to the checkbox element that solves my problem.

    thanks

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    From what I read, if a checkbox input is set to readonly you can click to change the check but it doesn't change the value. So I would do it this way.

    <input type="checkbox" readonly="readonly" onclick="return(false);" />

    david_kw

  • #3
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Is there not a way to get it exactly how I like that is set the value and leave it unchangeable to the user??

  • #4
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That way didn't work for you? How exactly do you want to set it? From html? From javascript?

    What was wrong with that example. Did it allow you to change the value?

    david_kw

  • #5
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Oops yeh my mistake, works like a charm. Thanks !!


  •  

    Posting Permissions

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