Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa HTML radio button value on edit action
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Nilima Avinash Raut
radio button value on edit action
0 Answer(s)      2 years and 11 months ago
Posted in : HTML


This is my edit.jsp code...In my project 'm having search module where i have to search customer by name...I have provided show edit add and delete link for each customer that is searched...Problem 'm facing is on edit action 'm not retrieving radio button value..i have used if else logic..Bt its not working...My edit.jsp code is:-Radio button name is Payment type.

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit Customer details</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <link href="VTdevelopers.css" rel="stylesheet" type="text/css" />
        <script language="javascript">
            function f2(edit_customer)
              {
                var name = document.edit_customer.name.value;
                var nom1 = document.edit_customer.nominee1.value;
                var nom2 = document.edit_customer.nominee2.value;
                var occu = document.edit_customer.occupation.value;  
                var addr = document.edit_customer.address1.value;
                var city = document.edit_customer.city.value;
                var state = document.edit_customer.state.value;
                var pincode = document.edit_customer.pincode.value;
                var contact = document.edit_customer.contact.value;
                var email = document.edit_customer.email.value;
                var gatno = document.edit_customer.gatno.value;
                var gunno = document.edit_customer.gunthano.value;
                var cost = document.edit_customer.cost.value;
                var amount = document.edit_customer.amount.value;
                var paydt = document.edit_customer.datum1.value;
                var chqno = document.edit_customer.chqno.value;
                var bnknm = document.edit_customer.bankname.value;
                var paytype = document.edit_customer.payment_method.value;

                var amt = document.edit_customer.amount1.value;
                var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; 

                 if(name == "")
                  {
                     alert("Name Can't be blank");
                     return false;
                  }
                 if(nom1 == "")
                  {
                     alert("First Nominee Can't be blank");
                     return false;
                  }
                  if(nom2 == "")
                  {
                     alert("Second Nominee Can't be blank");
                     return false;
                  }
                   if(occu == "")
                  {
                     alert("Occupation Can't be blank");
                     return false;
                  }
                   if(addr == "")
                  {
                     alert("Address Can't be blank");
                     return false;
                  }
                   if(city == "")
                  {
                     alert("City Can't be blank");
                     return false;
                  }
                   if(state == "")
                  {
                     alert("State Can't be blank");
                     return false;
                  }
                   if(pincode == "")
                  {
                     alert("Pincode Can't be blank");
                     return false;
                  }
                   if(contact == "")
                  {
                     alert("Contact Number Can't be blank");
                     return false;
                  }
                   if(gatno == "")
                  {
                     alert("Gat Number Can't be blank");
                     return false;
                  }
                  if(gunno == "")
                  {
                     alert("Quantity of guntha Can't be blank");
                     return false;
                  }
                   if(cost == "")
                  {
                     alert("Land cost Can't be blank");
                     return false;
                  }
                   if(amount == "")
                  {
                     alert("Total Amount Can't be blank");
                     return false;
                  }
                  if(paydt == "")
                  {
                     alert("Payment date Can't be blank");
                     return false;
                  }
                  if(paytype == "cheque")
                    {
                      if(chqno == "")
                      {
                       alert("Cheque Number Can't be blank");
                       return false;
                      }
                      if(bnknm == "")
                      {
                         alert("Bank Name Can't be blank");
                         return false;
                      }
                     }
                  else
                     {
                        return true;
                     }
                  if(amt == "")
                  {
                     alert("Amount Can't be blank");
                     return false;
                  }
                  if(emailPattern.test(email))
                    {
                       return true;
                    }
                    else
                    {
                       alert("Invalid Email Address");
                       return false;
                    }


                }


                function toggle(value)
                 {

                    if(value=='show')
                    {


                        document.edit_customer.chqno.style.visibility = 'visible';
                        document.edit_customer.bankname.style.visibility = 'visible';
                        document.getElementById("chq").style.visibility = 'visible';
                        document.getElementById("bnk").style.visibility = 'visible';

                    }
                   else
                     {

                       document.edit_customer.chqno.style.visibility = 'hidden';
                       document.edit_customer.bankname.style.visibility = 'hidden';
                       document.getElementById("chq").style.visibility = 'hidden';
                       document.getElementById("bnk").style.visibility = 'hidden';
                     }
                }

                function payment_hide()
                 {



                       document.edit_customer.chqno.style.visibility = 'hidden';
                       document.edit_customer.bankname.style.visibility = 'hidden';
                       document.getElementById("chq").style.visibility = 'hidden';
                       document.getElementById("bnk").style.visibility = 'hidden';

                }
        </script>
    </head>
    <body class="body" onload="payment_hide();">
    <jsp:include page="links.jsp"/>
        <% String usn = (String)session.getAttribute("username");
   int custid=Integer.parseInt(request.getParameter("cust_id"));
    int gatid=Integer.parseInt(request.getParameter("gat_id"));
//out.println("<a href='edit_form_database.jsp?cust_id="+custid+"' >
        out.println("<form name='edit_customer'  method='post' action='edit_form_database.jsp?cust_id="+custid+"&gat_id="+gatid+"'>");%>

<% 

%>
 <% 
           try
           {
        if(usn == null)
         {
            response.sendRedirect("login.jsp");        
         }
           }
           catch(Exception e)
           {
                out.println(e);
           }

        %>

        <%
     Connection con=null;
                                       try 
                                       {          
                                       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                       con=DriverManager.getConnection("jdbc:odbc:vtdevelopers","","");
                                       }
                                       catch(Exception e) 
                                       {  
                                       out.println("<h1>server not functioning well </h1>");                                        
                                       }

                                        if(con!=null)
                                       {

                                       try 
                                       {
                                       String s="select * from customer_details where cust_id="+custid+"";

                                       Statement statement = con.createStatement();
                                       ResultSet rs = statement.executeQuery(s);


                                       String s1="select * from land_details where cust_id="+custid+" and gat_id="+gatid+" ";

                                       Statement stm1 = con.createStatement();
                                       ResultSet rs1 = stm1.executeQuery(s1);


                                       String s2="select * from payment_details where cust_id="+custid+" and gat_id="+gatid+" ";

                                       Statement stm2 = con.createStatement();
                                       ResultSet rs2 = stm2.executeQuery(s2);


                                       while(rs.next()) 
                                       {
 %>

        <table align="right">
            <tr>
               <td>
                 <blink>Welcome <%=(String)session.getAttribute("username")%></blink>
               </td>
                <td>
                    <a href="logout.jsp">Logout</a>
                </td>
            </tr>
        </table>
    <h5 class="loginform"><u>CUSTOMER DETAILS FORM</u></h5>


    <table cellpadding="0" cellspacing="0" align="center" border="5" bordercolor="#003333" align="center" width="70%">
        <tr>
          <td>
             <b class="label">Title<b>
          </td>
          <td>
            <select name="title">
                 <option value="Mr.">Mr.</option>
                 <option value="Mrs.">Mrs.</option>
                 <option value="Miss">Miss.</option>
            </select>
          </td>
           <td>
             <b class="label">Name<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(2)%>" name="name">
          </td>
        </tr>
         <tr>
          <td>
             <b class="label">Name of Nominee1<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(10)%>" name="nominee1">
          </td>
          <td>
             <b class="label">Name of Nominee2<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(11)%>" name="nominee2">
          </td>
        </tr>
        <td>
             <b class="label">Occupation<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(9)%>" name="occupation">
          </td>
          <td>
             <b class="label">Address<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(4)%>" name="address1">
          </td>
        <tr>
          <td>
             <b class="label">City<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(5)%>" name="city">
          </td>
          <td>
             <b class="label">State<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(6)%>" name="state">
          </td>
        </tr>
        <tr>
          <td>
             <b class="label">Pincode<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(7)%>" name="pincode">
          </td>
           <td>
             <b class="label">Contact No.<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(3)%>" name="contact">
          </td>
        </tr>
        <tr>
         <td>
             <b class="label">Email-id<b>
          </td>
          <td>
             <input type="text" value="<%=rs.getString(8)%>" name="email">
          </td>
            <%
            }while(rs1.next())
            {
        %>
        </tr>
    </table>

     <h5 class="loginform"><u>LAND DETAILS</u></h5>
     <table cellpadding="0" cellspacing="0" align="center" border="5" bordercolor="#003333" align="center" width="70%">
         <tr>
           <td>
              <b class="label">Gat No.<b>
           </td>
           <td>
              <input type="text" value="<%=rs1.getString(1)%>" name="gatno">
           </td>       
           <td>
              <b class="label">Quantity Of Guntha<b>
           </td>
           <td>
              <input type="text" value="<%=rs1.getString(2)%>" name="gunthano">
           </td>       
         </tr>
         <tr>
           <td>
              <b class="label">Land Cost<b>
           </td>
           <td>
              <input type="text" value="<%=rs1.getString(4)%>" name="cost">
           </td>       
           <td>
              <b class="label">Total Amount<b>
           </td>
           <td>
              <input type="text" value="<%=rs1.getString(3)%>" name="amount" >
           </td>       
           <%
            }while(rs2.next())
            {
           %>
         </tr>
     </table>
     <h5 class="loginform"><u>PAYMENT DETAILS</u></h5>
     <table cellpadding="0" cellspacing="0" align="center" border="5" bordercolor="#003333" align="center" width="70%">
         <tr>
           <td width="25%">
              <b class="label">Payment Type<b>
           </td>
           <td width="40%">
           <% if (<%rs2.getString(1).equals("cash")%>) {%>
            <INPUT TYPE=radio NAME="payment_method" VALUE="cash" CHECKED onclick="toggle('hide');"><b class="label" >By Cash</b></input>
            <%} else {%>

             <INPUT TYPE=radio NAME="payment_method" VALUE="cheque" Checked onclick="toggle('show');"><b class="label">By Cheque</b></input>
             <%}%>
           </td>  
           <td>
              <b class="label">Payment Date<b>
           </td>
           <td>
              <jsp:include page="calendar_1.html" />
           </td>       
         </tr>
         <tr rowspan="4">
           <td>
              <b class="label" id="chq">Cheque Number<b>
           </td>
           <td>
                <input type="text"  value="<%=rs2.getString(2)%>" name="chqno">
           </td> 
            <td>
              <b class="label" id="bnk">Bank Name<b>
           </td>
           <td>
                <input type="text" value="<%=rs2.getString(3)%>" name="bankname">
           </td>  
         </tr>
         <tr colspan="2">

           <td>
              <b class="label">Amount<b>
           </td>
           <td>
                <input type="text" value="<%=rs2.getString(6)%>" name="amount">
           </td>
       <%
            }
       %>
         </tr>
     </table>
       <h5></h5>
      <table cellpadding="0" cellspacing="0" align="center" border="0" bordercolor="#003333" align="center" width="70%">
         <tr>
           <td align="center"> 

               <% //out.println("<a href='edit_form_database.jsp?cust_id="+custid+"' ><input type="submit" value="update" name="update" /></a>");%>
              <input type="submit" value="UPDATE" name="cancel" class="button" onclick="return f2(edit_customer)">
              <input type="submit" value="CANCEL" name="cancel" class="button" onclick="show.jsp">
           </td>
         </tr>

      </table>
      <%

         }
    catch(Exception e) 
         {

           out.println(e);
          }
                                        }
%>  

    </body>
</html>

please help me asap its urgent..


Advertisement
View Answers

Related Tutorials/Questions & Answers:
radio button value on edit action
...Problem 'm facing is on edit action 'm not retrieving radio button value..i have used if else logic..Bt its not working...My edit.jsp code is:-Radio button name...radio button value on edit action  This is my edit.jsp code...In my
Drop down and radio button value on edit action
the value from dropdown and radio button.. But the problem goes with edit action...Drop down and radio button value on edit action  HI, I have... for text boxes..bt select default value for dropdown and radio button...How do
Advertisements
passing value of radio button
passing value of radio button  hi,i have 3 jframe built using the GUi editor in net beans 6.9. i have two radio button in the first jframe.i have to get the selected item appear on the 3rd frame after passing through the second
to get radio button value - Struts
to get radio button value   hello friend, i have a problem regarding... two major problems:- 1.these radio button is not going to select also 2.i want to set the "value" attribute of radio button in the above code. Can u help
Get radio button value after submiting page
Get radio button value after submiting page  Radio buttons are dynamically generated.After selecting radio button & submitting the page , the value of the selected radio button get displayed in that jsp page. <
Retrieve value of radio button from database to form
Retrieve value of radio button from database to form  var gn=document.getElementsByName("empg"); //empg is name of radio input type. for(var i=0;i
Struts 2 radio button value problem
Struts 2 radio button value problem  When I use s:radio tag in struts 2, I'm not able to get the selected value using document.getElementById... gives first radio option's value as the value for any option selected. Ex
check radio button on retrieving the value from database.
check radio button on retrieving the value from database.  HI i am... database and according to that i want to check the cash cheque radio button... information from database the i want to show cash radio button checked.How can i do
get a radio button click value - JSP-Servlet
get a radio button click value  thanks sir for sending code ,but i have one probs that is i m getting a null value i m calling getParameter("id... in the input tag name="radio" eventhough i m getting a null value please help me
radio button
radio button  On selecting a radio button, it should open a aspx page
Dojo Radio Button
. For creating radio button you need "dijit.form.CheckBox". The radio button do some action on press.  Try Online: Radio Button The RadioButton class...Dojo Radio Button         
RADIO FROM JSP TO ACTION.
RADIO FROM JSP TO ACTION.  Hi frds, how to get the selected multiple radio button values from jsp to action
Selecting a radio button in jquery autocomplete from database value
Selecting a radio button in jquery autocomplete from database value  ... radio button? Here is the pertinent code: $("#name").autocomplete... to do is to select the appropriate radio button. Any pointers please
How to add radio button value in a table for particular field?
How to add radio button value in a table for particular field?  Hi,I... one radio button for text field then it insert only one value absent OR present... dynamically from other table and two radio button one for present and the second
get a value when a radio button clicked - JSP-Servlet
get a value when a radio button clicked  sorry sir my actual probs is that 1st i m callig a jsp in that i m displaying a table where i used a radio button to access a value(also used u r code),then in this jsp i m having a forms
get a value when a radio button clicked - JSP-Servlet
get a value when a radio button clicked  Here is my code sir please help me if any changes in the code please give me sir thanks in advance.. //login.jsp <% EmployeeDataBase employeeDataBase = new
uitableview edit done button
uitableview edit done button  How to add Edit / Done button in UITableView with an action on click?   UITableview Edit done Button To add " Edit / Done button " in UITableView add the given code in UIView Controller
Query on radio button
Query on radio button  I am having a multiple row in jsp page.They are dynamically coming. For each row there is one radio button. I want to select... the value of a particular row selected to the Action class. The values of the row
radio button - Development process
but when i click on cr radio button and enter value in text box.it enter the msg but it again go to sr radio button   Hi friend, Plz give full...radio button  hi, there is 2 radio button and five text box
UINavigationBar Edit Button
UINavigationBar Edit Button  UINavigationBar Edit Button Given is the code that adds a edit button item as a nav bar item in your UINavigation Controller. -(void)viewDidLoad; { [super viewDidLoad]; UINavigationBar* navBar
iPhone Radio Button Example
iPhone Radio Button Example  Can you please suggest me how to create Radio button in my iPhone application. Actually, in my application i have two... click on that button it get selected and by default it should display unselected
validation of radio button
validation of radio button  There are 3 radio button as A,B,W. there are another radio as 1,2,3.if we select W in first radio button then should select 2nd one(1,2,3).if we select A or B not need select any one from 1,2,3
Pass value of rasio button from jsp page to action class(not conventional problem)
Pass value of rasio button from jsp page to action class(not conventional...; </table> <s:submit value="Delete" action="deleteSchedule...;table border="1"> <tbody> <s:iterator value
Radio button Validation
Radio button Validation  Hi.. How to validate radio button in java?if the radio button is not selected an error message should be given... Please...()==false)){ JOptionPane.showMessageDialog(null,"Please select radio button
Radio Button in HTML
by the text next to the radio button. It is not the value attribute. Use of a Radio..." name="Button" value="Water"> Water<br> <input type="radio" name="Button" value="Beer"> Beer<br> <input type="radio" name="Button
Radio Button Problem in jsp.
radio button values from jsp to action using javascript...Radio Button Problem in jsp.  I have a small doubt in my application, my requirement is to get a "single selectible row", I generated a radio button
how to check the radio button automatically depending up on the value of database when editing the form...
how to check the radio button automatically depending up on the value... to highlight the radio button from the database.......nd even list box also can any... button. When the user clicks the particular radio button, that data will get shown
Struts 2 Radio Button
radio buttons and I am using Struts2 tag.I want first rado button to be selected by default.But when i select the second radio button and hit on search button i want to retain the selection of that second radio button on search list
java radio button and exception
java radio button and exception  Dear Sir/Madam, I have problem with my addBagelRadioButton and addCheeseRadioButton. There should be only 1 radio button can be selected, but somehow 2 can be selected the same time. Also, I
dependent radio button
of the Radio Button is to select only one option at a time. So you don't need...dependent radio button  Hi. I have 4 radio buttons say all,chocolate,cookie,icecream. If I select all the other 3 should not able to be selected
Using radio button in struts - Struts
, but the radio button has only just one value that i can pass.what can i do to solve...Using radio button in struts  Hello to all , I have a big problem... options to choose : Serial number 12345 radio button - selection 1 radio button
Advertisements
 

 

 

DMCA.com