Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to make it only one single radio button's things display when page load?

    Here are the coding..

    Code:
    <jsp:useBean id="chequeStopBean" scope="session" class="my.com.infopro.ibank.ui.bean.ChequeStopBean"/>
    <jsp:useBean id="labelBean" scope="session" class="my.com.infopro.ibank.ui.bean.LabelBean"/>
    <jsp:useBean id="lang" scope="session" class="my.com.infopro.ibank.ui.bean.LanguageBean" />
    
    <%@ page language="java" import = "java.util.*" errorPage="" %>
    <%@ page import="my.com.infopro.ibank.dto.ChequeDTO"%>  
    <%
        request.getSession(true);
    	String contextPath = request.getContextPath();
        chequeStopBean.queryAccList();
        //RequestDispatcher dispatcher = null;
       
    %>
    <html>
    
    <head>
    <title><%=labelBean.getLabel("STOP_CHEQUE")%></title>
    <meta HTTP-EQUIV="Pragma" content="no-cache"> 
    <meta HTTP-EQUIV="Expires" content="-1"> 
    <jsp:include page="/ScriptHeader.jsp"/>
    <script language="javascript">
    
     
    function validateAndSubmit() {
    	
    
    	var msg1 = "<%=labelBean.getLabel("MSG_REQUIRED_FIELD")%>";
    	var msg2 = "<%=labelBean.getLabel("MSG_CANNOT_CONTAIN_CHARACTER")%>";
    	var msg3 = "<%=labelBean.getLabel("MSG_IN_THE_FIELD")%>";
    	var msg4 = "<%=labelBean.getLabel("MSG_PLEASE_ENTER")%>";
    	var msg5 = "<%=labelBean.getLabel("WITH")%>";
    	var msg6 = "<%=labelBean.getLabel("TO")%>";
    	var msg7 = "<%=labelBean.getLabel("MSG_CHARACTER")%>";
    	var msg8 = "<%=labelBean.getLabel("MSG_PLEASE_ENTER_VALID_NUMBER")%>";
    	var msg9 = "<%=labelBean.getLabel("MSG_REQUIRED_FIELD")%>";
    	var msg10 = "<%=labelBean.getLabel("MSG_WITH_EXACTLY")%>";
    	var msg11 = "<%=labelBean.getLabel("MSG_WITH_VALID_DATE")%>";
    	var msg12 = "<%=labelBean.getLabel("MSG_EXAMPLE_DATE")%>";
    	var msgNum11 = "<%=labelBean.getLabel("MSG_WITH_A_MINIMUM_VALUE_OF")%>";
    	var msgNum12 = "<%=labelBean.getLabel("MSG_WITH_A_MAX_VALUE_OF")%>";
    	var msgNum13 = "<%=labelBean.getLabel("MSG_PLEASE_ENTER_ROUND_INETEGER")%>";
    	var msgNum14 = "<%=labelBean.getLabel("MSG_PLEASE_ENTER_AT_MOST")%>";
    	var msgNum15 = "<%=labelBean.getLabel("MSG_DECIMAL_PLACES")%>";
    	var msgEnter = "<%=labelBean.getLabel("MSG_PLEASE_ENTER_VALID")%>";
    	var errorMsg = "<%=labelBean.getLabel("MSG_LOWECASE_ALPHABET_ALLOWED")%>"
    
    
    	var radioButtons = document.getElementsByName("radio");
    	      for (var x = 0; x < radioButtons.length; x ++) {
    	    	
    	        if (radioButtons[x].checked) {
    		        if(radioButtons[x].value=="1")
    		        {
    		      	             			    
    		        	if (! validateTextEntry(form.chqNum, "<%=labelBean.getLabel("CHQNUM")%>" + " ", true,11,11, msg1, msg2, msg3, 
    				 	    	msg4, msg5, msg6, msg7, msg10) )
    				        return false;
    		        	
    		        	if (! validateAlphabet(form.chqNum, "" + " ",1, msg2,"" ))
    				        return false;	
    				  	
    			  
    		        }
    		        else if(radioButtons[x].value=="2")
    		        {
    
    		        	if (! validateTextEntry(form.chqNumFrom, "<%=labelBean.getLabel("CHQNUMFROM")%>" + " ", true,11,11, msg1, msg2, msg3, 
    				 	    	msg4, msg5, msg6, msg7, msg10) )
    				        return false;
    
    		        	if (! validateTextEntry(form.chqNumTo, "<%=labelBean.getLabel("CHQNUMTO")%>" + " ", true,11,11, msg1, msg2, msg3, 
    				 	    	msg4, msg5, msg6, msg7, msg10) )
    				        return false;
    
    			     	if (! validateAlphabet(form.chqNumFrom, "" + " ",1, msg2,"" ))
    				        return false;	
    
    			     	if (! validateAlphabet(form.chqNumTo, "" + " ",1, msg2,"" ))
    				        return false;	      		    	    		    
    	    	        
    	    	        if(form.chqNumFrom.value == form.chqNumTo.value){
    		    	        alert("<%=labelBean.getLabel("MSG_CANNOT_SAME")%>");	
    	    	            return false;
    	    	        }
    	    	              
    	             }
    	           }
    	      }	
    	   						
    	    return true;
    	}
    
    
    
    	
    function show(id) 
    {  
         if (document.getElementById(id).style.display == 'none')  
         { 
        	  
              document.getElementById(id).style.display = 'block';                           
         } 
          
    }  
    //-->  
      
    <!--  
    function hide(id)  
    {  
              document.getElementById(id).style.display = 'none';   
    } 
    
    </script>
    </head>
    
    <body onload="show('single')">
    <form name="form" method="POST" action="<%=contextPath%>/ChequeStopServlet?tranx=confirm" dir="<%=lang.getDir()%>" >
    
      <table width="500" align="center">
        <tr> 
          <td align="left" colspan="3">&nbsp;</td>
        </tr>
        <tr> 
          <td align="left" colspan="3" class="mainHeader"><%=labelBean.getLabel("STOP_CHEQUE")%></td>
        </tr>
    	<tr>
    	<td colspan="3">&nbsp;</td>
    	</tr>
    	<tr>
    	<td colspan="3" class="subHeader"><%=labelBean.getLabel("CHQ_DETAIL") %></td>
    	</tr>
    	
    	<tr> 
          <td colspan="3"><div align="center"> 
              <p class="statusError"> 
                <%if(request.getParameter("error") != null) out.println(labelBean.getLabel(request.getParameter("error"))); else out.println("");%>
              </p>
            </div></td>
        </tr>
    	
    	</table><br />
    	<table width="500" align="center">
        <tr> 
          <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("ACC_NUMBER")%></td>
          <td width="10"  class="lbl">:</td>
          <td width="305" align="left">  
          <select size="1" name="accNum">
           
    	 <%
    	  		for (Iterator iter = chequeStopBean.getAccList().iterator(); iter.hasNext();) {
    	  			 ChequeDTO chqDto = (ChequeDTO)iter.next();	
    	  		
    	  %>
    	 <option value="<%=chqDto.getAccNum()%>"><%=chqDto.getAccNum()%></option>
    	  <%  } %>
    	  </select>
    	  </td>
        </tr>
        <tr>		
    		<td align="right">
    			<input type="radio" class="radioStyle"  name="radio" value="1"  onfocus="show('single');hide('multiple');hide('multiple1');return true;" checked="checked" >
    			<%=labelBean.getLabel("STOP_SINGLE")%>
    		</td>
    		<td>&nbsp;</td>
    		<td>
    			<input type="radio" class="radioStyle"  name="radio" value="2"  onfocus="hide('single');show('multiple');show('multiple1');return true;">
    			<%=labelBean.getLabel("STOP_MULTIPLE")%>
    		</td>
    	</tr>
    	
        <tr id="single"> 
          <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("CHEQUE_NUMBER")%></td>
          <td  class="lbl"width="10">:</td>
          <td colspan="2" align="left"> 
          <input name="chqNum" type="text" size="15"> 
    	  </td></tr>
    	  	  
    	 <tr id="multiple" style="display: 'none'"> 
          <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("FROM_CHEQUE_NUMBER")%></td>
          <td  class="lbl"width="10">:</td>
          <td colspan="2" align="left"> 
            <input name="chqNumFrom" type="text" size="15"> 
    	  </td></tr>
    	  
    	  <tr id="multiple1" style="display: 'none'"> 
          <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("TO_CHEQUE_NUMBER")%></td>
          <td  class="lbl"width="10">:</td>
          <td colspan="2" align="left"> 	
    	   <input name="chqNumTo" type="text" size="15"> 
    	   </td></tr>
    	  	  
    	  
    	<tr>	  
    	  <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("REASON")%></td>
    	  <td  class="lbl" width="10" >:</td>
    	  <td colspan="2">
    	  <select name="reason">
    	  <option value="Lost"><%=labelBean.getLabel("LOST")%></option>
    	  <option value="Stolen"><%=labelBean.getLabel("STOLEN")%></option>
    	  <option value="Payment Cancellation"><%=labelBean.getLabel("PAYMENT_CANCELLATION")%></option>
    	  <option value="Others"><%=labelBean.getLabel("OTHERS")%></option>	  
    	  </select>
    	  </td>
    	  
    	</tr>
            
        <br/>
            <tr> 
          <td colspan="3">&nbsp;</td>
        </tr>
        <tr> 
          <td colspan="3" align="center"> 
          <input  class="button" type="submit" value="Next" onClick="return validateAndSubmit();" >      
          </td>
        </tr>
        <tr> 
          <td colspan="3">&nbsp;</td>
        </tr>
    	<tr> 
          <td colspan="3"  align="left" class="footer"><%=labelBean.getLabel("NOTE")%>
           </td>
        </tr>
    	<tr><td colspan="3" class="footer">
    	 <ul>
             <li><%=labelBean.getLabel("THE_ASTERISK")%></li>
         </ul>
    	</td>
    	</tr>
        
      </table>
      
    
    <jsp:include page="/Footer.jsp" />
     </form>
    </body>
    </html>
    This is error for the first page..




    This is picture that which i wan..




    Thanks!

  • #2
    Regular Coder oVTech's Avatar
    Join Date
    Nov 2010
    Location
    USA
    Posts
    296
    Thanks
    4
    Thanked 54 Times in 52 Posts
    Quote Originally Posted by gsting_88 View Post
    Here are the coding..
    Code:
    <jsp:useBean id="chequeStopBean" scope="session" class="my.com.infopro.ibank.ui.bean.ChequeStopBean"/>..........
    A question that sometimes drives me hazy: am I or are the others crazy?
    -Albert Einstein-




    I don't know, I don't care, and it doesn't make any difference!
    -Albert Einstein-




  • #3
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to make it only one single radio button's things display when page load?

    Sorry for the inconvenient!

    Here are js i using.

    function show(id)
    {
    if (document.getElementById(id).style.display == 'none')
    {

    document.getElementById(id).style.display = 'block';
    }

    }
    //-->

    <!--
    function hide(id)
    {
    document.getElementById(id).style.display = 'none';
    }
    Part of my code is ..

    <tr>
    <td align="right">
    <input type="radio" class="radioStyle" name="radio" value="1" onfocus="show('single');hide('multiple');hide('multiple1');return true;" checked="checked" >
    <%=labelBean.getLabel("STOP_SINGLE")%>
    </td>
    <td>&nbsp;</td>
    <td>
    <input type="radio" class="radioStyle" name="radio" value="2" onfocus="hide('single');show('multiple');show('multiple1');return true;">
    <%=labelBean.getLabel("STOP_MULTIPLE")%>
    </td>
    </tr>

    <tr id="single">
    <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("CHEQUE_NUMBER")%></td>
    <td class="lbl"width="10">:</td>
    <td colspan="2" align="left">
    <input name="chqNum" type="text" size="15">
    </td></tr>

    <tr id="multiple" style="display: 'none'">
    <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("FROM_CHEQUE_NUMBER")%></td>
    <td class="lbl"width="10">:</td>
    <td colspan="2" align="left">
    <input name="chqNumFrom" type="text" size="15">
    </td></tr>

    <tr id="multiple1" style="display: 'none'">
    <td class="lbl"><span class="requiredFieldIndicator">* </span><%=labelBean.getLabel("TO_CHEQUE_NUMBER")%></td>
    <td class="lbl"width="10">:</td>
    <td colspan="2" align="left">
    <input name="chqNumTo" type="text" size="15">
    </td></tr>

    Although i set show(single) to default checked. But it also display show(multiple).

    The problem is how can i use onload method in <body>?

    Thanks!

  • #4
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to make it only one single radio button's things display when page load?

    I have found solution ..

    <body onload="hide('multiple');hide('multiple1')">

    Thanks!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •