• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

in my form I have 4 radio button when i click one Radio button i want to be Uncheced Remaining three Radio buttons

in my form I have 4 radio button in JSF when i click one Radio button i want to be Uncheced Remaining three Radio buttons

Could you please give me a Pseudo code for that

Could you please correct my program
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<f:view>
<html>
	<head><title>Navigation Page</title></head>
	<body>
<script type="text/javascript"> 
 		
        
        function radioButton(radio) {
                alert("enter into javascript");
        
         document.getElementById("myform:radio1").checked = false; 
         document.getElementById("myform:radio2").checked = false;
         document.getElementById("myform:radio3").checked =false;
         
         radio.checked = false;
       }
        
	</script>
	
		<h:form>
		<link href="<%=request.getContextPath()%>/theme/main.css"
				type="text/css" rel="stylesheet">
<table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tbody>
   <tr>
    <td class="txt">
     <table width="100%" border="0" cellpadding="5" cellspacing="0">
       <tbody>
        <tr valign="top" bgcolor="#ffffff">
          <td class="hblack" colspan="2" bgcolor="#ffffff">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tbody>
                <tr>
                  <td bgcolor="#ccccff">
                    <table width="100%" border="0" cellpadding="5" cellspacing="1">
                      <tbody>
                        <tr>
                          <td class="txt" width="89%" bgcolor="#eeeeee">

                            <span class="hblack">Work with a Client 
                            </span>
                            <input name="flag" type="hidden">

                           </td>
                          </tr>
                         </tbody>
                        </table>
                       </td>
                      </tr>
                     </tbody>
                    </table>
                   </td>
                  </tr>
                   <tr valign="top" bgcolor="#ffffff">
                    <td class="txt" colspan="2" bgcolor="#ffffff">

                        Enter a client ID, CARE member ID or partial client name, then click Next. 

                    </td>
                   </tr>
                    <tr valign="top" bgcolor="#ffffff">
                      <td class="txt" colspan="2" bgcolor="#ffffff">
            
                        <table border="0" cellpadding="0" cellspacing="5">
                          <tbody><tr>
                            <td><h:selectOneRadio id="radio" onclick="radioButton(this)">
<f:selectItem  itemValue="Search by Client User ID"/>

</h:selectOneRadio></td>
                            <td class="hblack">Search by Client User ID </td>
                          </tr>
                           <tr>
                            <td>&nbsp;</td>
                            <td class="txt"><h:inputText id="name"
					value=""></h:inputText></td>
                           </tr>
                            <tr>
                              <td><h:selectOneRadio id="radio1">
<f:selectItem  itemValue="Search by CARE Member ID " />

</h:selectOneRadio></td>
                              <td class="hblack">Search by CARE Member ID </td>
                            </tr>
                             <tr>
                               <td>&nbsp;</td>
                               <td class="txt"><h:inputText id="CLIENTWISE_ID"
					value=""></h:inputText></td>
                            </tr>
                             <tr>
                               <td><h:selectOneRadio  id ="radio2">
<f:selectItem  itemValue="Find client profiles where client name contains " />

</h:selectOneRadio></td>
                               <td class="hblack">Find client profiles where client name contains </td>
                             </tr>
                              <tr>
                                <td>&nbsp;</td>
                               <td class="txt"><h:inputText id="ClientName"
					value=""></h:inputText></td>
                             </tr>
                              <tr>
                                <td><h:selectOneRadio id="radio3">
<f:selectItem  itemValue="Find client profiles where banker name contains " />

</h:selectOneRadio></td>
                                <td class="hblack">Find client profiles where banker name contains </td>
                             </tr>
                              <tr>
                                <td>&nbsp;</td>
                              <td class="txt"><h:inputText id="BankerName"
					value=""></h:inputText></td>
                             </tr>
                             
                             <tr>
                             <td> </td>
                                  <td class="hblack">Select By Client Type </td>
                             </tr>
                             <tr>
                             <td> </td>
                               <td>   <h:selectOneMenu id="SelectUserType"
			>
			<f:selectItem id="Client" itemLabel="Client"
				itemValue="Client" />
			<f:selectItem id="demo" itemLabel="demo"
				itemValue="demo" />
			<f:selectItem id="Survey" itemLabel="Survey" itemValue="Survey" />
		</h:selectOneMenu></td>
                             </tr>
                            </tbody></table>
                            
                          </td>
                         </tr>
                          <tr valign="top" bgcolor="#eeeeee">
                            <td class="txt">
                    
                            <h:commandButton value="Next" styleClass ="button" />
                            
                            
                              
                              
                     
                           </td>
                           
                            <td class="txt">
                    
                           <h:outputLink value="WorkWithAClient_AdvancedSearch.jsp"><h:outputText value="AdvancedSearch"/></h:outputLink>
                           
                              
                              
                     
                           </td>
                            <td class="txt" align="right">
                    
                        
                            </td>
                             <td class="txt" align="right">
                    
                        
                            </td>
                            
                            <td class="txt" align="right">
                    
                        
                            </td>
                             <td class="txt" align="right">
                    
                        
                            </td>
                           </tr>
                          </tbody>
                         </table>
                        </td>
                       </tr>
                    
                       </tbody>
                      </table>
		
			
		</h:form>
	</body>
</html>
</f:view>

Open in new window

0
Manikandan Thiagarajan
Asked:
Manikandan Thiagarajan
  • 2
1 Solution
 
Manikandan ThiagarajanSenior consultantAuthor Commented:
mbonaci:

that is myquestion only

i have found the answer with h:datatable radio button

i want ordinary form with table it would contians 4 h select radio buttons
0
 
mbonaciCommented:
Aha, you're JS guy, sorry.

Call something like this from radio onClick event (i haven't tested it):
function clearAllButMe(myself){
    var radios = document.getElementsByTagName('input');

    for(var i = 0; i < radios.length; i++){
        if(radios[i].getAttribute('type') == 'radio' && radios[i].getAttribute('name') != myself.getAttribute('name') )
            radios[i].checked = false;
    }
}

Open in new window

0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now