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.
Page 1 of 3 123 LastLast
Results 1 to 15 of 37
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    readonly checkbox - is it possible ?

    Is it possible, using thin client technology to create a standard html checkbox readonly, not disabled - just read only.

    Any help would be greatly appreciated here.

    Thanks in advance

    Steve.

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes you can use the readonly property -

    <input name="chkbox1" type=checkbox readonly>check box 1

    ... I don't see the point of it though.

  • #3
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you want to be sure to use valid markup, use this:

    <input readonly="readonly">
    CATdude about IE6: "All your box-model are belong to us"

  • #4
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    they don't work.

    What I'm after is basically a copy of an html form that has already been filled in, its being sent over email and Its a legal requirement that the emailed form be totally readonly. This solution does not work, in any respect by the looks of it.

    Thanks

    Steve.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Why can't you use a hidden value?
    <input type="hidden" value="somevalue">
    I'm not even sure if you can use readonly with a checkbox. You might have to use some javascript.
    <input type="checkbox" checked="checked" onclick="return false" onkeydown="return false">

  • #6
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Quote Originally Posted by steveg
    Its a legal requirement that the emailed form be totally readonly.
    A pre-filled, read-only form isn't a form at all, it's just a regular document.
    If the content isn't intended to be edited, why bother using form elements?

  • #7
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My thoughts exactly... rethink about what you need to do.

    And yes you can 'readonly' a checkbox... but it's irrelevant, hence why I said I didn't see the point. In checkboxes it's either on or off, you don't change the 'value' asuch, that's why the readonly property is best suited to elements such a text boxes.

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Mark have you tried to make checkbox readonly using only the readonly property? It doesn't let you at least not this way

    <input type="checkbox" readonly checked="checked">

    or this way

    <input type="checkbox" readonly="readonly" checked="checked">

    You can however have it checked and make it disabled

    <input type="checkbox" disabled="disabled" checked="checked">

    but since the user is probably using this for the wrong reasons then this may be irrelevant.

  • #9
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I haven't experimented with it as I didn't need to lol, but yes much better to disable a checkbox... or even better to make it hidden.

  • #10
    Regular Coder
    Join Date
    Jun 2005
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Um. . .

    If none of those work for you, I suggest creating a small checkbox image. That'll make it read-only.

    Edit: nevermind. I didn't realize you wanted to send it through e-mail. . .
    Last edited by sesshyzkidz; 06-28-2005 at 07:08 PM.

  • #11
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Quote Originally Posted by _Aerospace_Eng_

    You can however have it checked and make it disabled

    <input type="checkbox" disabled="disabled" checked="checked">
    Disabling is not really an option when trying to 'lock' the value of a form element. The data contained in a disabled form element isn't passed forward to be processed. It is simply ignored.

  • #12
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can think of any number of reasons why you might want to do this. I have come across this thread because, in my case, I want to display truth values stored in a database in a table (not a form), and a readonly checkbox would be very useful. Also, what if forms that have been entered by one person need to be sent to another for appoval? The approver must certainly _not_ be able to change any entered data, only approve or deny the previously submitted data.
    And what about dynamic forms where the checkbox is only relevant if another value elsewhere has already been entered, selected, checked, etc.? You may always want a result from the checkbox regardless of whether the use was able to check it or not.

    So I tried all the suggestions here and absolutely none worked. The idea of an image would certainly work, but it is an almighty pain because checkboxes look different in different browsers and you want a consistent look and feel, this is very hard to achieve without having different images for every possible browser!

    What you want is the kind of image you get in Windows form when a checkbox is readonly, i.e. it is greyed out.

    So if anyone has any suggestions, I'd be extremely grateful.

  • #13
    Regular Coder Karen S. Garvin's Avatar
    Join Date
    Nov 2006
    Location
    Maryland
    Posts
    227
    Thanks
    5
    Thanked 2 Times in 2 Posts
    you want a consistent look and feel,
    What about creating a PDF file? You won't need to worry about the checkboxes or graphics on the client's end.
    ----------------------------------------------
    Karen S. Garvin
    http://ksgarvin.wordpress.com

  • #14
    New Coder
    Join Date
    Feb 2007
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Rumplestiltzkin View Post
    what if forms that have been entered by one person need to be sent to another for appoval? The approver must certainly _not_ be able to change any entered data, only approve or deny the previously submitted data.
    Wouldn't it make more sense to display the value of the data as text and then just add a "Approve" submit button. If content is never designed to be edited, then it doesn't need to be in an input.

    Quote Originally Posted by Rumplestiltzkin View Post
    And what about dynamic forms where the checkbox is only relevant if another value elsewhere has already been entered, selected, checked, etc.? You may always want a result from the checkbox regardless of whether the use was able to check it or not.
    This situation is what the disable feature in a form is for. You may use Javascript to disable a form field until another is completed etc.

    All of this sounds like you're trying to use form inputs to do something that there is better ways of doing. Both the readonly and disabled code listed above worked for me by the way.

  • #15
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by andrewmta View Post
    Wouldn't it make more sense to display the value of the data as text and then just add a "Approve" submit button. If content is never designed to be edited, then it doesn't need to be in an input.
    Not if you want the approval form to look the same as the data entry form. This is clearer for users.

    Quote Originally Posted by andrewmta View Post
    All of this sounds like you're trying to use form inputs to do something that there is better ways of doing.
    Yes & no. I just like the look of the checkbox. I could display text values (Yes/No, True/False), but a checkbox looks better.

    Quote Originally Posted by andrewmta View Post
    Both the readonly and disabled code listed above worked for me by the way.
    Well not for me. Readonly (in Firefox) just gives you a regular checkbox which is editable, tabable, etc. Disabled blanks the value whether it's checked or not. I think it works in IE, but I'm sure we've all been burned by taking advantage of Microsoft's non-standard extensions!

    Quote Originally Posted by andrewmta View Post
    This situation is what the disable feature in a form is for. You may use Javascript to disable a form field until another is completed etc.
    I understand this, but using disabled has disadvantages:
    • the value does not get submitted with the form; there are times when you may want to capture (or re-capture) the value even though the user cannot edit it.
    • some browsers blank out the checkbox when it is disabled, thus preventing you from displaying a value.

    The point is you don't always want to actually disable an input, just stop the user from making further changes.
    Last edited by Rumplestiltzkin; 02-21-2007 at 01:43 AM. Reason: Grammar correction


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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