The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How do you make Checkboxes and Radio Buttons READONLY?
Ann-Marie Foster
post Mar 20 2019, 12:17 AM
Post #1





Group: Members
Posts: 7
Joined: 5-August 18
Member No.: 26,686



After competing the transaction I display and reconstruct a web page for viewing and printing. Checkboxes and Radio Buttons are restored to the saved check state but although set as READONLY they can be altered by the customer. How do I lock their setting?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 20 2019, 04:37 AM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,403
Joined: 9-August 06
Member No.: 6



According to the spec, I think it should be possible with the bolean readonly attribute. Only it doesn't work with radio and checkboxes for some obscure reason.

Is it possible for you to programmatically give all inputs but the checked ones the disabled attribute? That would prevent any changes. The downside is that the disabled values won't be sent when the form is submitted, but if this is only for display that shouldn't matter.

CODE
<input type="radio" name="fruit" disabled>Apple
<input type="radio" name="fruit" disabled>Pear
<input type="radio" name="fruit" checked>Banana
<input type="radio" name="fruit" disabled>Cherry


You could make all inputs disabled, but then the checked one will be grayed out, if that matters to you. It doesn't seem possible to change the color with CSS. It is for for example disabled text inputs, but it doesn't seem to work with radio buttons and checkboxes.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Ann-Marie Foster
post Mar 20 2019, 10:00 AM
Post #3





Group: Members
Posts: 7
Joined: 5-August 18
Member No.: 26,686



Well I solved the problem with brute force, I put an "OnClick" on each button that calls the program that displayed them in the first place so any alteration attempts are immediately overwritten.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 20 2019, 01:56 PM
Post #4


.
********

Group: WDG Moderators
Posts: 8,239
Joined: 10-August 06
Member No.: 7



QUOTE(Ann-Marie Foster @ Mar 20 2019, 06:17 AM) *

After competing the transaction I display and reconstruct a web page for viewing and printing. Checkboxes and Radio Buttons are restored to the saved check state but although set as READONLY they can be altered by the customer. How do I lock their setting?

Another idea might be to remove all form elements from the printable page and use images instead of real checkboxes.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st October 2019 - 05:25 PM