Home Answers Viewqa HTML radio button value on edit action

 
 


Nilima Avinash Raut
radio button value on edit action
0 Answer(s)      a year and 5 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..

View Answers









Related Pages:
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
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
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. <
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 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
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
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
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
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
How to use radio button in jsp page
How to use radio button in jsp page       This is detailed java code how to use radio button in jsp code and display a message in another jsp page according
Edit the record.
displayed that data.side of them there is an edit button which will edit...;%=rs.getString(5)%></td> <td><input type="button" name="edit" value="Edit" style="background-color:green;font-weight:bold;color:white;" onclick
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
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
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
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
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
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
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 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
Struts2.2.1 radio Tag Example
Struts2.2.1 radio Tag Example The radio tag is a UI tag that render a radio button input field. The following Example will shows how to implement the radio...;title>Example radio Tag</title> </head> <
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
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
jsp :how to edit table of data displayed using jsp when clicked on edit button
;<input type="button" name="edit" value="Edit" style="background-color:green... want to edit this information in table when clicked on edit button and save... the particular edit button, that data will get shown in another page and allow the user
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
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
Update / Edit data
="button" name="edit" value="Edit" style="background-color:green;font-weight:bold... consists of that particular id. When the user clicks the particular edit button...Update / Edit data  Hello, i want to create a page to edit or update
radio button in jsp - JSP-Servlet
radio button in jsp  hye there.how do I create radio button in jsp?Could you please gimme an example of shopping cart in jsp which have I have using... action in the JSP page from the following link. http://www.roseindia.net/jsp
radio button
radio button  On selecting a radio button, it should open a aspx page
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name="delete...delete and edit options in struts   Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
Radio Button in Java
Radio Button in Java       Radio Button is a circular button on web page that can be selected by the user. The AWT  Widget used to create a radio button is Checkbox
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page  hi.. the code below... are matched from database. I want to pass the selected value in Struts Action FormBean...; <input name="radiobutton" type="radio" value="radiobutton" />
I'm using struts2,i'm asking about the radio button validation <s:radio>
I'm using struts2,i'm asking about the radio button validation   my form < s: form action="creatingcv" method="post" onsubmit="return valider()" id="frmSaisie"> < s:radio name="cv.gender" label="Gender" list="{'Male
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
="500"></td><td><input type="button" value="Delete" name...delete and edit options in struts  Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my
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 pass input from radio button to jsp page
how to pass input from radio button to jsp page  hi.. the code below... are matched from database. I want to pass the selected value in Struts Action FormBean...; <input name="radiobutton" type="radio" value="radiobutton" />
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page  hi.. the code below... are matched from database. I want to pass the selected value in Struts Action FormBean...; <input name="radiobutton" type="radio" value="radiobutton" />
Radio Buttons in HTML
;  The Radio Button in HTML are type of input form, which allows... must specify the name of radio button properly.  Understand with Example... radio button at a time among alternative buttons. <input type> :The <
<s:radio> in struts 2 is not setting the correct value. - Struts
","No"); when i checked either of two (i.e Yes/No), only the radio button value... in struts 2 is not setting the correct value.  hello, i m using the following code in my jsp: where pa is HashMap object defined in action
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.