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 1027139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:11:40+00:00 2026-05-16T12:11:40+00:00

Below i have pasted my piece of javascript code here 1) function showCustomerName(dropdown) {

  • 0

Below i have pasted my piece of javascript code here

1)

  function showCustomerName(dropdown) {
  var selectedCustomer = dropdown.options[dropdown.selectedIndex].value;
  var currentCustomer = document.getElementById('currentCustomer');
  alert(selectedCustomer); 

  var context = document.forms[0].context.value;
  document.forms[0].mode.value = "UPDATE";
  document.forms[0].custName.value = selectedCustomer ;
  document.forms[0].action=context+"/updateReportDetail.do";
  document.forms[0].method="POST";
  document.forms[0].submit();
}

2)

 function showCustomerID(dropdown) {
  var currentCustomer = document.getElementById('currentCustomer');
  var selectedCustomerID = dropdown.options[dropdown.selectedIndex].value;
  alert(selectedCustomerID);   

  var context = document.forms[0].context.value;
  document.forms[0].mode.value = "UPDATE";
  document.forms[0].custName.value = currentCustomer;
  document.forms[0].custID.value = selectedCustomerID ;
  document.forms[0].action=context+"/updateReportDetail.do";
  document.forms[0].method="POST";
  document.forms[0].submit();
}


<select id="currentCustomer" onchange="showCustomerName(this)">
 <c:forEach var="Customer" items="${listCustomer}" >
   <option value="<c:out value="${Customer}" />"><c:out value="${Customer}" />
   </option>
  </c:forEach>
 </select>

<select id="currentCustomerID" onchange="showCustomerID(this)">
 <c:forEach var="CustomerID" items="${listCustomerID}" >
   <option value="<c:out value="${CustomerID}" />"><c:out value="${CustomerID}" />
   </option>
  </c:forEach>
 </select>

the above code is working fine.
The thing is i need to retrieving value from “showCustomerName()” to “showCustomerID()” script .

In “showCustomerID()” script method i am retrieving “showCustomerName()” methods value as object

var currentCustomer = document.getElementById('currentCustomer');

how to retrieve it as a value? i dont want to retrieve as object

please help me guys.

  • 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-05-16T12:11:41+00:00Added an answer on May 16, 2026 at 12:11 pm

    Just need to grab the value

    var currentCustomer = document.getElementById('currentCustomer').value;
    alert(currentCustomer);
    

    Though you should make sure it exsts

    var currentCustomerElement = document.getElementById('currentCustomer');
    var currentCustomer = (currentCustomerElement) ? currentCustomerElement.value : "not found";
    

    Or am I misunderstanding what you are trying to retrieve?

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

Sidebar

Related Questions

I have some function (pasted below little piece of function), which I used as
I have a code piece that looks something like what I've pasted below: import
I have a plot (sample code pasted below) that I am trying to add
I am new to java swing. I have pasted my code below for your
The code I have pasted below is meant to display images on the middle
I have below piece of code: if (null != result[1]) { mySearchTO.setDt(dateFormat2.parse(result[1].toString())); } else
I have pasted two function from my code. They are for adding a tab
I have the below piece of code which Prefixs a string to the start
Below I have a function that animates a div ( container ) either to
Below I have table - Company id name value year 1 IBM 10 2011

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.