problem in reset() function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhuriks
    New Member
    • Jun 2010
    • 149

    problem in reset() function

    hi,
    in my application...i had a modify page...im facing problem with reset() function...here is my code...can anyone provide me the solution

    Code:
    <input type="reset" value="CLEAR" onclick="window.clearForm();">
    clear.js

    Code:
    function clearForm()
    {
        document.frm.reset();
    }
    thanks,
    madhu
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Code:
    <input type="reset" value="CLEAR">

    Comment

    • madhuriks
      New Member
      • Jun 2010
      • 149

      #3
      hi,
      i tried that one previously..but it is not taking....the form is not getting cleared..in my jsp i used EL...it is not showing any error..can u provide me the solution

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        then there might be a problem with your HTML. did you validate the HTML?

        Comment

        • madhuriks
          New Member
          • Jun 2010
          • 149

          #5
          yes..i validated each and every field....

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            I’m not talking of input validation. I’m talking of standards compliance.

            Comment

            • madhuriks
              New Member
              • Jun 2010
              • 149

              #7
              i didnt get u..here is my jsp page..can u once chk it..

              Code:
              <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
              <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
              <jsp:useBean id="packDetails" class="nxl.util.GprsPackDetails">
                  <jsp:setProperty  name="packDetails" property="packName"  param="packName"/>
              </jsp:useBean>
              <%
                          packDetails.loadDetails(request);
              %>
              <html>
                  <head>
                      <title> GPRS </title>
                      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                      <style rel="stylesheet" type="text/css" media="screen">
                          legend {
                              font-size:  1.4em;
                              font-weight:  bold;
                              position:  relative;
                              top:  -.4em;
                          }
              
                      </style>
                      <script type="text/javascript" src="/proj/script/mdetails.js"></script>
                      <script type="text/javascript" src="/proj/script/psobit.js"></script>
                      <script type="text/javascript" src="/proj/script/lowbalrtry.js"></script>
                      <script type="text/javascript" src="/proj/script/multiAct.js"></script>
                      <script type="text/javascript" src="/proj/script/autoRenew.js"></script>
                      <script type="text/javascript" src="/proj/script/diffBalChk.js"></script>
                  
                  </head>
                  <body bgcolor=#F0F8FF>
                      <form name="frm" method="post" action="/proj/modify">
                          <font color="#FFFFFF"></font>
                          <input name="oldpackName" type="hidden" value="${packDetails.packDetails.generalPackDetails.packName}">
                          <p align="center">&nbsp;</p>
                          <div style="background: #cf2255; width:'100%'" align="center">
                              <font color="#ffffcc" size="12pt"><b> GPRS </b></font></div>
                          <div style="background: #ffffcc; width:'100%'" align="center"/>
                          <tr><td colspan="2"><center><h1><i><b><font color="#800000">GPRS Modify
                                                  </font></b></i></h1></center></td></tr>
              
                          <fieldset><legend>General</legend>
                              <table>
                                  <tr>
                                      <td></td>
                                      <td><font color="#800000">&nbsp;</font><font color="#800000"><b>Pack Name</b></font>
                                          <font color="#800000" size="">&nbsp;</font></td>
                                      <td><input name="packName" type="text" id="packName" value="${packDetails.packDetails.generalPackDetails.packName}"></td>
                                      <td></td>
                                      <td><font color="#800000"><b>Activation Status</b></font><font color="#800000" size=""><b></b></font><font color="#800000" size=""><b></b></font><font color="#800000" size="">&nbsp;</font></td>
                                      <td><input type="text" name="actStatus" id="actStatus" disabled value="${packDetails.packDetails.generalPackDetails.actStatus}"></td>
                                      <td></td>
                                      <td><font color="#800000"><b>De-Activation Status</b></font></td>
                                      <td><input type="text" name="deactStatus" disabled value="${packDetails.packDetails.generalPackDetails.deactStatus}"></td>
                                      <td></td>
                                      <td><font color="#800000" size=""><b>Allow Post-Paid</b></font></td>
                                      <td><select NAME="allowPostPaid" id="allowPostPaid">
                                              <option value="TYPE,1:" ${packDetails.packDetails.generalPackDetails.allowPostPaid == 'TYPE,1:' ? 'selected' : ''}>Post and Pre-Paid</option>
                                              <option value="TYPE,2:" ${packDetails.packDetails.generalPackDetails.allowPostPaid == 'TYPE,2:' ? 'selected' : ''}>Post-Paid</option>
                                              <option value="NO" ${packDetails.packDetails.generalPackDetails.allowPostPaid == 'NO' ? 'selected' : ''}>No</option>
                                          </select></td>
                                      <td></td>
                                  </tr>
              
               <td>
                                          <input type="button" value="MODIFY" style="width: 80; height: 20; border: 1px solid #0000FF" onClick="login();">
                                          <input type="reset" value="clear">
                                      </td>
                                  </tr>
                              </center>
                          </table>
                      </form>
                  </body>
              </html>

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                omg … from what I see it looks like it should work, but the HTML is hopelessly outdated (the use of <font> is deprecated for decades). check http://validator.w3.org/ for HTML compliance.

                Comment

                • madhuriks
                  New Member
                  • Jun 2010
                  • 149

                  #9
                  it is showing unable to validate my page..

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    did you put in the JSP source code?

                    Comment

                    • madhuriks
                      New Member
                      • Jun 2010
                      • 149

                      #11
                      yes i kept like that..

                      Comment

                      • Dormilich
                        Recognized Expert Expert
                        • Aug 2008
                        • 8694

                        #12
                        I was expecting that.

                        well, the HTML validator expects HTML code (not JSP code, it’s not a JSP validator), thus you have to transform your JSP page in HTML (request the page from your server, save the source code and validate that)

                        Comment

                        • madhuriks
                          New Member
                          • Jun 2010
                          • 149

                          #13
                          i had a doubt can u tell me...if the form takes default values...is it possible to clear the form information..

                          Comment

                          • Dormilich
                            Recognized Expert Expert
                            • Aug 2008
                            • 8694

                            #14
                            you will always reset to the default values.

                            Comment

                            • madhuriks
                              New Member
                              • Jun 2010
                              • 149

                              #15
                              k..i'll try what u suggested

                              Comment

                              Working...