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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:49:44+00:00 2026-06-13T21:49:44+00:00

I have two functions defined that are basically supposed to get a value from

  • 0

I have two functions defined that are basically supposed to get a value from drop down menu and depending on what was selected, throw up a table and form using AJAX.

Here are my 2 functions:

function showParts(str)
{
if (str=="")
  {
  document.getElementById("partvalues").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("partvalues").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getparts.php?q="+str,true);
xmlhttp.send();
}

function showOrders(str)
{
if (str=="")
  {
  document.getElementById("otherparts").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("otherparts").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","formOrder.php?q="+str,true);
xmlhttp.send();
}
</script>

I tested those 2 functions and they both work properly. I have 2 PHP pages which have a query to retrieve the appropriate values. But the problem is, when I try to run both of them as onchange events, neither of them work.

echo "<select name = finishgood_list onchange = showParts(this.value); showOrders(this.value)>";
        while ($row = mysql_fetch_array($result))
        {
            echo "<option value='" . $row['fg_id'] . "'>" . $row['fg_id'] . "</option>";
        }

If I try and nest the functions within parenthesis, neither of them work when I change values in my drop down menu. I tested them individually and they both work fine but I cannot get them both to work at the same time.Only the first function is executing so If I change those around the showOrder will work but not the other.

Are there any problems here? If I can’t do it this way, is there another way to retrieve the appropriate values dynamically when selecting a value from a drop down menu?

  • 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-13T21:49:46+00:00Added an answer on June 13, 2026 at 9:49 pm

    At a guess, the most obvious change is from

    echo "<select name = finishgood_list onchange = showParts(this.value); showOrders(this.value)>";
    

    to

    echo "<select name = 'finishgood_list' onchange = 'showParts(this.value); showOrders(this.value);' >";
    

    I.e wrap the attributes in quotes.

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

Sidebar

Related Questions

I have defined the following two functions test <- function(t) { return( (0.5*eta^2/theta)*(1-exp(-2*theta*t)) )
I have two functions that return simple strings. Both are registered. $.views.helpers({ parseDate: function
I have two functions that caluclate and adjust the height and width of elements
I have two functions, but one of the functions is only called from the
I have two functions that have different enough logic but pretty much the same
I have two functions that are working as expected def getSomething: Promise[JsValue] def getSomethingElse:
Friends, I have two files, a.c and b.c . I have defined a function
I have two functions here function Preloader() {} Preloader.prototype = { init:function() { //
I have two functions in an ActionScript class, they are: private function loaderCompleteHandler(event:Event):void {
I have two functions whose underlying logic is the same but in one case

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.