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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2003
    Posts
    601
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Quick Form / Checkbox Disable Question

    Hey Guys,

    I've got the following code being used to make a checkbox selected and readonly when a radio button value is selected:

    Code:
    document.myForm.valueName.checked = true;
    document.myForm.valueName.disabled = true;
    However when submitting the form values in email, the value of the checkbox won't submit with the checkbox value being disabled (if I comment out that second line, it works). Of course, I don't want the value able to be unselected.

    Any suggestions? Can I make it readonly instead?

    Thanks.

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    You can enable the field onsubmit.

    You can register an onclick handler that returns false.

    You can store the real value in a hidden field and use the checkbox as a means of populating that field.

    Those are mine. I favor the first and 2nd over the third.


  •  

    Posting Permissions

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