How do you make Checkboxes and Radio Buttons READONLY? |
How do you make Checkboxes and Radio Buttons READONLY? |
Ann-Marie Foster |
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?
|
pandy |
Mar 20 2019, 04:37 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 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. |
Ann-Marie Foster |
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.
|
Christian J |
Mar 20 2019, 01:56 PM
Post
#4
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
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. |
Lo-Fi Version | Time is now: 23rd April 2024 - 03:20 AM |