| Author |
How to make Radio group read only
|
Raghu Shapkota
Greenhorn
Joined: Dec 10, 2005
Posts: 9
|
|
Hello Ranchers,
I want to know how to make the Radio Group readonly. i am reading the data from the database and say for example if the value is yes radio button is checked or else it's not.
I am not able to make the radio group readonly. I don't want the user to be able to make the changes while viewing.
Your suggestions would be highly appreciated.
thanks
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Raghu,
First use javascript to disable the radio button by default. somethig like form.radio1.disabled=false (use count of radio buttons and disable each one of them)
Second in the server , either dont get the radio button value from request parameter or validate the radio button value and take action accordingly.
This is just simple logic i can think of now.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
What type of radio group? HTML, Swing, AWT, ...?
But Balu has given the answer regardless of the type: disable the radio buttons. Although you don't need JavaScript for that in HTML; you can also use the disabled attribute for that.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Raghu Shapkota
Greenhorn
Joined: Dec 10, 2005
Posts: 9
|
|
Thanks balu for the suggestion.
It works when you put in the code like <radio label="On" disabled="true"/> on the view page
However this is a component (I am using ZK framework) and i want to make it read only via java class when some event happens.
I also need to be able to edit it in the update mode.
Thanks
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Raghu,
i' hv not tried Zk framework , it supposedly should contains it own way to present UI components and its attributes. you can probably need to look at the documentation to find the counterpart for "disabled" feature and use it.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
ZK is AJAX, so off to the proper forum.
|
 |
 |
|
|
subject: How to make Radio group read only
|
|
|