radio button value on edit action

Ads
 

radio button value on edit action

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._-][email protected][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..

View Answers

Ads









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
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
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
radio button
radio button  On selecting a radio button, it should open a aspx page
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
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
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 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
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
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
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
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
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
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
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
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
how to get radio value
how to get radio value    how to retrive the option value and insert the next table pls give example
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
validate radio button using javascript
validate radio button using javascript  validate radio button using javascript
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
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
access into radio button
access into radio button  access the four fields of database called access,access file and stored in radio button.please help
when radio button is selected corresponding jsp page should open
="openPage();"><br> Edit Profile<input type="radio" value="edit" name...when radio button is selected corresponding jsp page should open  how..."){ window.location.replace("view.jsp"); } else if(selection[i].value=="edit
display contents on the same page by selecting a radio button
;input type="radio" name="bill_status " value="due" /> Received<input type="radio" name="bill_status" value="received" /> <% String... on the same page under the radio button
On selecting a radio button, it should open a jsp page.
On selecting a radio button, it should open a jsp page.  Hi, COuld you please tell me how to link a radio button selection to a jsp. My requirement is if I select a radio button then it should open a jsp page. thank you
pass radio button values to next page
pass radio button values to next page  how to pass selected radio button values which coming from mysql database to next page using php. Please show me with examples

Ads