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

  • Home
  • SEARCH
  • 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 7974145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:17:27+00:00 2026-06-04T08:17:27+00:00

like this is my form’s select box <select name=cutid onchange=findcustid(this.value)> <option value=1001>cust 1</option> <option

  • 0

like this is my form’s select box

<select name="cutid" onchange="findcustid(this.value)">
<option value="1001">cust 1</option>
<option value="1002">cust 2</option>            
<option value="1003">cust 3</option>            
</select>

now i have this ajax code which is passing and fill some select boxes

function findcustid(custid) {
    var custid = custid;
}

function Inint_AJAX() {
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {} //IE
    try {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {} //IE
    try {
        return new XMLHttpRequest();
    } catch (e) {} //Native Javascript
    alert("XMLHttpRequest not supported");
    return null;
};

function dochange(src, val) {
    var req = Inint_AJAX();
    req.onreadystatechange = function () {
        if (req.readyState == 4) {
            if (req.status == 200) {
                document.getElementById(src).innerHTML = req.responseText; //retuen value
            }
        }
    };
    req.open("GET", "podetfill.php?data=" + src + "&val=" + val + "&custid=" + custid); //make connection
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
    req.send(null); //send value
}
window.onLoad = dochange('proid', -1); // value in first dropdown

on this line

req.open("GET", "podetfill.php?data="+src+"&val="+val+"&custid="+custid);

of above code i’ve added +"&custid="+custid this but its not pass value of custid on podetfill.php page and getting error

Error: custid not defined
  • 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-04T08:17:29+00:00Added an answer on June 4, 2026 at 8:17 am

    You cannot use your method for the following reasons :

    • the var custid is declared within a function – so its only accessible within that function
    • Even if the var custid was declared a global you still couldn’t use it as the AJAX gets executed using the window.load event meaning the select.change event wouldnt have been fired yet

    One solution would be to get the value of the select before using it :

    var cus = document.getElementById('custid');
    var custid = cus.options[cus.selectedIndex].value;
    req.open("GET", "podetfill.php?data=" + src + "&val=" + val + "&custid=" + custid); //make connection
    

    you also need give the select an id attribute to use this code :

    <select id="custid" name="cutid" onchange="findcustid(this.value)">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have HTML that looks like this: <form id=kinodForm> <input type=text name=element[5] value=krispy kreme
I have a simple form like this: <form id='myForm'> <input type='text' name='Textbox'> <select name='SelectBox'>
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
I have a form like this: <form id=loginCompact action=https://externalsite... name=sportsbook method=post onsubmit=createCookie('BRLOG', document.sportsbook.username.value, 1)>
I have a form like this: <form id=surveyForm method=post action=submit.php> <input type=text id=good value=0
I have an HTML form like this: form.html: <html> <body> your name is :<br><br>
I have a form like this: <form id=form_main name=form_main action=/search/ target=iframe001 method=get onSubmit=reset_and_subm();> Enter
I have a bunch of form elements in my form like this: <select id=sectionNumber
i want insert this form value to datanase : <input type=checkbox name=brand1 id=brand1 value=1>
lets say I have this form <form name=myform action=/acms/test/multiselect/blah action=GET> <select name=mytextarea[] multiple=multiple> <option

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.