File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make Radio group read only

 
Raghu Shapkota
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raghu Shapkota
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ZK is AJAX, so off to the proper forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic