473,511 Members | 15,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unchecking a checkbox in a visual web jsf page

25 New Member
Hey All...

I have visual web jsf page, developed in netbeans 6.0, and it has a layout panel which contains three(3) checkboxes of the woodstock component variety. If a user checks one of the checkboxes and then decides to check another, I want the previously checked checkbox to become unchecked. Is this possible?? Please provide some example code if it is.

Thanks...

Silgd
Sep 17 '08 #1
3 2683
Nepomuk
3,112 Recognized Expert Specialist
So, you have three JCheckBoxes and you only want one to be selected at any time? Why don't you use Radio buttons? Here's the Java API for the JRadioButton and here's a HowTo for the three main kinds of button ("normal" buttons, CheckBoxes and Radio buttons).

Greetings,
Nepomuk
Sep 18 '08 #2
ajos
283 Contributor
So, you have three JCheckBoxes and you only want one to be selected at any time? Why don't you use Radio buttons? Here's the Java API for the JRadioButton and here's a HowTo for the three main kinds of button ("normal" buttons, CheckBoxes and Radio buttons).

Greetings,
Nepomuk
Err..Nepo this is not related to Swings. Its regarding to jsf components ;)
Sep 18 '08 #3
Nepomuk
3,112 Recognized Expert Specialist
Err..Nepo this is not related to Swings. Its regarding to jsf components ;)
Ah sorry, in that case no JCheckBoxes or JRadioButtons, but I'm sure there will be some kind of Radio buttons available in JSF.

...

There, found something. Look at this code:
Expand|Select|Wrap|Line Numbers
  1. <f:use_faces>
  2.     <h:form formName="pform">
  3.         ..........
  4.         <p><h:output_text value="Alignment:"/><br>
  5.         <h:selectone_radio id="align" valueRef="pbean.align"
  6.                 layout="LINE_DIRECTION">
  7.             <f:validate_required/>
  8.             <h:selectitem itemValue="left" itemLabel="Left"/>
  9.             <h:selectitem itemValue="center" itemLabel="Center"/>
  10.             <h:selectitem itemValue="right" itemLabel="Right"/>
  11.         </h:selectone_radio>
  12.         <br><h:output_errors for="align"/>
  13.         ..........
  14.     </h:form>
  15. </f:use_faces>
It will generate this HTML code:
Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="/usingjsf/faces/edit.jsp">
  2.     ..........
  3.     <p>Alignment:<br>
  4.     <table border="0">
  5.         <tr>
  6.             <td><input type="radio" checked 
  7.                 name="align" value="left"> Left</td>
  8.             <td><input type="radio" 
  9.                 name="align" value="center"> Center</td>
  10.             <td><input type="radio"
  11.                 name="align" value="right"> Right</td>
  12.         </tr>
  13.     </table>
  14.     <br>
  15.     ..........
  16. </form>
There you go, radio buttons. They should work fine. :-)

Greetings,
Nepomuk <--- doesn't know much about JSF shamefully
Sep 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
6593
by: Mike Lopez | last post by:
Hello. I need to set a checkbox to the "checked" state and prevent the user from unchecking it. I tried using "disabled", but then the value is not passed on the Post to an ASP page. Anyone...
0
343
by: Pat Roy | last post by:
Hello... I've created a treeview that looks something like: Root .....Folder1 .........Subfolder1A .............File .............File .........Subfolder1B
4
10511
by: moondaddy | last post by:
There are different times when I will have a group of checkboxes and need to force only one to be checked at a time. I would also like to do this client side and not require a postback. These...
5
9153
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
2
1465
by: Chelimar | last post by:
Hi, I need to tell a checkbox list that if two of the items have been checked, to uncheck themselves. I need help! Thanks :) ~Chelimar
1
5886
by: Ramakrishnan Nagarajan | last post by:
Hi, I have two checkboxes in each row of a grid. One for Modify and another one for View. If I click Modify the View should get automatically checked and should be disabled. Earlier I did this in...
0
2783
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
3
2813
by: Ryanfromscotland | last post by:
Hey there everyone, this is my first post so be nice :-) I have wrote quite a bit so the actual question is written out at the end if you want to skip on and see if you can answer it without the rest...
1
1839
Death Slaught
by: Death Slaught | last post by:
I play a game that when your backpack fills with items (the limit is 45) you must choose items to discard by unchecking their box. This is very annoying and time consuming so I was wondering if it...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.