Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9006201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:20:52+00:00 2026-06-16T01:20:52+00:00

In the below jsp, when i change the dropdown list the values are not

  • 0

In the below jsp, when i change the dropdown list the values are not getting cleared. please help me with it. But the other function(Enable()) is working fine. Could any one please let me know where am i going wrong.

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Untitled Document</title>
<script type="text/javascript">
    document.getElementById("Comp_Text").value=document.getElementById("tgt1").value;
    function Enable(){
        if(document.getElementById("abcd").value=="DAIS")
            {
                    document.getElementById("c1").disabled=true;
                    document.getElementById("c2").disabled=true;
                    document.getElementById("c3").disabled=true;
                    document.getElementById("c4").disabled=true;
                    document.getElementById("c5").disabled=true;
                    document.getElementById("c6").disabled=true;
                    document.getElementById("c1").value='0';
                    document.getElementById("c2").value='0';
                    document.getElementById("c3").value='0';
                    document.getElementById("c4").vaue='0';
                    document.getElementById("c5").value='0';
                    document.getElementById("c6").value='0';
                    document.getElementById("tot1").readOnly=false;
            }
            else
                {
                    document.getElementById("c1").disabled=false;
                    document.getElementById("c2").disabled=false;
                    document.getElementById("c3").disabled=false;
                    document.getElementById("c4").disabled=false;
                    document.getElementById("c5").disabled=false;
                    document.getElementById("c6").disabled=false;
                    document.getElementById("tot1").readOnly=true;
                }

    }
    function Sum()
    {
        var int1=document.getElementById("c1").value;
        var int2=document.getElementById("c2").value;
        var int3=document.getElementById("c3").value;
        var int4=document.getElementById("c4").value;
        var int5=document.getElementById("c5").value;
        var int6=document.getElementById("c6").value;
        document.getElementById("tot1").value=parseInt(int1)+parseInt(int2)+parseInt(int3)+parseInt(int4)+parseInt(int5)+parseInt(int6); 
    }
    function clear(){
                    document.getElementById("c1").value='';
                    document.getElementById("c2").value='';
                    document.getElementById("c3").value='';
                    document.getElementById("c4").vaue='';
                    document.getElementById("c5").value='';
                    document.getElementById("c6").value='';
    }

</script>
</head>

    <body>
<form id="form1" name="form1" method="post" action="UpdateCounts_DB.jsp">
    <input type="text" name="Comp_Text" id="Comp_Text" value="<%=(String)request.getParameter("tgt1")%>" size="100" style="border: 0"/>
    <table width="420" cellspacing="3"> <tr><td width="37">Types</td>
  &nbsp;
  &nbsp;
  &nbsp;
  <td width="127">
      <select name="abcd" id="abcd" onchange="Enable();clear()" >
          <!--<optgroup label="a">-->
          <option value="">Select the Type</option>
          <option value="Updates">Updates</option>  
          <option value="Multibases">Multibases</option>
          <option value="DAIS">DAIS</option>
          <option value="Acds">Admin Codes</option>
          <option value="Legis">Legis</option>
          <option value="LegAll">Legis-All</option>
          <option value="Ins">Ins And Reg</option><!--</optgroup>--></select></td>
          <td width="236"> <font size="-1" color="#0033CC"> Select your Update Type From the Drop Down</font>
          </td> </tr></table>
  <p>
    <label for="DB Count">DB Count</label>&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="text" name="DB_Count" id="DB_Count" style="width:30px" value="<%String abc=(String)request.getAttribute("abc");%>"/>
  </p>
    <font size="5" color="#0033CC">Fill all the below fields, enter Zero if there are no changes in a section</font>
  <table width="312" border="0">
    <tr>
      <td width="156"><label>
      Summary</label></td>
      <td><label for="c1"></label>
          <input type="text" name="c1" id="c1" style="width:30%" onchange="Sum();"/></td>
    </tr>
    <tr>
      <td><label>
    Contents</label></td>
        <td><input type="text" name="c2" id="c2" style="width:30%" onchange="Sum()"/></td>
    </tr>
    <tr>
      <td><label>
    Citation Formats</label></td>
        <td><input type="text" name="c3" id="c3" style="width:30%" onchange="Sum()"/></td>
    </tr>
    <tr>
      <td><label>
      Searching and Fields</label></td>
        <td><input type="text" name="c4" id="c4" style="width:30%"  onchange="Sum()" /></td>
    </tr>
    <tr>
      <td><label>
    Related Research</label></td>
        <td><input type="text" name="c5" id="c5" style="width:30%" onchange="Sum()"/></td>
    </tr>
    <tr>
      <td><label>
    Legal Notices</label></td>
        <td><input type="text" name="c6" id="c6"  style="width:30%" onchange="Sum()"/></td>
    </tr>
    <tr><td>Update Count</td><td>
            <input type="text" name="tot1" id="tot1" style="width:30%" readonly="readonly"/></td></tr>
    </table>
  <p>
    <input type="submit" name="Enter" id="Enter" value="Submit" />
      </p>
</form>
</body>
</html>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:20:53+00:00Added an answer on June 16, 2026 at 1:20 am

    Try giving a different name to the clear() function, like say clearValues() or clearFields():

    function clearFields(){ // name changed
    
        document.getElementById("c1").value='';
        document.getElementById("c2").value='';
        document.getElementById("c3").value='';
        document.getElementById("c4").vaue='';
        document.getElementById("c5").value='';
        document.getElementById("c6").value='';
    }
    

    This may be due to the fact that clear() is used by the browser. Though I couldn’t find any reference for clear in javascript keywords accept this.

    Also you may find this answer helpful as it is related to the use of clear and also this related to reserved words in javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending multiselect dropdown values to a JSP PAGE. Below is the AJAX
IN JAVA CODE IN JSP as below i m getting null value for fieldnoOfRecords.
Below are the code pieces in one jsp page, the function is to jump
I configured below exception resolver in my web configuration file but I am not
I am trying to use an image in the below index.jsp file in a
Below am posting my jsp page. home.jsp <%@taglib uri=/WEB-INF/struts-bean.tld prefix=bean%> <%@taglib uri=/WEB-INF/struts-html.tld prefix=html %>
In my .jsp file I have the code below. How can I compare the
how to display the selected options below in jsp <td width=75% valign=center> Start Date
I've got a function that queries my database and gets a list of usernames--
I have following page with code as below embeded in JSP. <!DOCTYPE HTML PUBLIC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.