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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:50:03+00:00 2026-06-17T08:50:03+00:00

I have a script below that works for auto-populating dropdown menu from the select

  • 0

I have a script below that works for auto-populating dropdown menu from the select tag based on INPUT TEXT .. How can I actually make it so if a user wants to change the option that has been autopopulated , he or she can still change what has been populated in the dropdown menu by the option of his or her choice while still leaving the AUTOPOPULATING feature on , I’d like it to still autopopulate , but in the event that a users doesn’t like the option , he can still change it .. Below is the working script for autopopulating the dropdown select

<html>
<head> <title> validation </title >
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
    <script type="text/javascript">
    function checkValues()
{
      jQuery("#ddl_StxName").val("stm3","stx2");
      jQuery("#ddl_rtumodel").val("both");

  ESNList = jQuery("#ESNList").val();
  if((ESNList >= 986329) && (ESNList <= 999999))
  {
    jQuery("#ddl_StxName").val("stx2");
    jQuery("#ddl_rtumodel").val("globalstar");
  }
  if ((ESNList >= 660000) && (ESNList <= 699999))
  {
    jQuery("#ddl_StxName").val("mmt");
    jQuery("#ddl_rtumodel").val("globalstar");
  }
   if ((ESNList >= 200000) && (ESNList <= 299999))
  {
    jQuery("#ddl_StxName").val("stm3");
    jQuery("#ddl_rtumodel").val("stmcomtech");
  }
   if ((ESNList >= 1202114) && (ESNList <= 1299999))
  {
    jQuery("#ddl_StxName").val("smartone");
    jQuery("#ddl_rtumodel").val("globalstar");
}

  // you should be able to follow the above and add your own conditions  
}

function checkInput()
{
  jQuery(":text").each(function (){
    if (jQuery(this).val().length == 0)
    {
      jQuery(this).css("border", "2px solid red");
    }
    else
    {
      jQuery(this).css("border", "0");
    }
  });
}
setInterval(function () {checkInput();checkValues();}, 500);
</script>
<body>
<form id="provision">
    ESNList:    <input  type="text" id="ESNList" name="ESNList" size="30" /> <br />
    ESN Start:<input type="text" id="ESNStart" name="ESNStart" size="10" /> <br />
    ESN End: <input type="text" id="ESNStart" name="ESNStart" size="10" /> <br />
    UnitName:<input type="text" id="STxName" name="STxName" size="30"  />  <br />  
     Unit Model:   <select name="STxName" id="ddl_StxName">
    <option value="stx2">STX2</option>
    <option value="stm3" selected>STM3</option>
    <option value="acutec">Acutec</option>
     <option value="trackpack">Trackpack</option>
    <option value="mmt">MMT</option>
    <option value="smartone">Smartone</option>
    <option value="smartoneb" >SmartOneB</option>
    </select> <br />
    RTU Model Type:
     <select name="rtumodel" id ="ddl_rtumodel">
    <option value="globalstar">GlobalStar</option>
    <option value="both">Both</option>
    <option value="comtech">Comtech</option>
    <option value="stmcomtech">STMComtech</option>
    </select> <br />
    <input type="submit" value ="submit"  />
    </form>
</body>
</html> 
  • 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-17T08:50:03+00:00Added an answer on June 17, 2026 at 8:50 am

    Hmmm My instinct is to use events rather than have all those constant background checks going via the setInterval….

    Something like this

    $(":text").css("border", "2px solid red");
    $(":text").keyup(function(){
      var enteredData = $(this).val()
      if (enteredData == "") {
        $(this).css("border", "2px solid red");
      } else {
        $(this).css("border", "inherit");
      }
      if ($(this).attr("id") == "ESNList"){
        esnList = parseInt(enteredData);
        switch (true){
          case ( esnList >= 986329 && esnList <= 999999):
              $("#ddl_StxName").val("stx2");
              $("#ddl_rtumodel").val("globalstar");
              break;
          case ( esnList >= 660000 && esnList <= 699999):
              $("#ddl_StxName").val("mmt");
              $("#ddl_rtumodel").val("globalstar");
              break;
          case ( esnList >= 200000 && esnList <= 299999):
              $("#ddl_StxName").val("stm3");
              $("#ddl_rtumodel").val("stmcomtech");
              break;
          case ( esnList >= 1202114 && esnList <= 1299999):
              $("#ddl_StxName").val("smartone");
              $("#ddl_rtumodel").val("globalstar");
              break;
        }
    
      }
    });
    

    Keeping to tradition, there is a fiddle here

    I think, if it was my project, I’d probably look at making and array of objects to manage the product range and use them to build the dropdowns and events – easier to manage in the long run for a little more work up front.

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

Sidebar

Related Questions

I have the script shown below that displays a list of records from a
I have a jQuery script below that clears the value of an input on
I have a script snippet looks like below: <ItemGroup> <files Include=*.txt></files> </ItemGroup> <Message Text=@(files)>
I have this function below. Works great and is from http://caroufredsel.dev7studios.com/ (by far the
i have this script below that will resize the .content on window resize it
I have a script that works perfect in ubuntu, recently I copied the exact
I am having a bizare problem where I have a script that works elsewhere
The idea of script below is preview the content from a text area. How
I have the below html that is supposed to create a fly out Menu.
I have this basic auto complete JavaScript that works well, but you need to

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.