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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:40:15+00:00 2026-06-14T14:40:15+00:00

So I’m using django and I have a page/template that looks like (simplified to

  • 0

So I’m using django and I have a page/template that looks like (simplified to only the relevant parts)

<select id="printerSelect" name="printer_id">
<option>Select Printer</option>                             
<option>printer1</option>                           
<option>printer2</option>                           
</select>

and later on I have something like

<div id="printerInfo">
No printer Selected
</div>

So the printerSelect list is populated by querying a mongodb database, finding the printer names and dynamically putting them in the list on a page load through django templates/context stuff. Is it possible to know when a user selects an option in that list and have it change the contents of the printerInfo div?

I know jquery as well if that helps. I think the main questions are:

  1. How to tell when a user changes a selection in the list (probably can be done with a binded jquery listener for it?)
  2. How to query the database for additional information based on that selected option

Edit

So I actually came up with a hacky way of doing this using what Sushanth suggested. Basically in the django template you create a bunch of divs that hold the additional information that is being requested from the database and that will eventually go into printerInfo.

Then using jquery you have a function that saves that information into variables, using “printer1”, “printer2” as map keys to that information. Then you remove these divs. Because this is all done right when the page is loaded the user never sees any of this.

Then whenever an item is selected, you use the selection text as a key to the map containing the value/text that’s going in the printerInfo div. Then it’s just a simple matter of changing its text field to whatever

  • 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-14T14:40:19+00:00Added an answer on June 14, 2026 at 2:40 pm

    You can use the .change() event to get the first requirement

    $('#printerSelect').on('change' , function() {
         // Code here
         var $this = $(this);
        var text = "No Printer Selected";
        if($this.find('option:selected').index() !== 0){
            text = $this.find('option:selected').text() + ' Selected';
        }     
        $('#printerInfo').html(text);
    }).change();​​​​
    

    Check Demo

    If you want to get the Data from the server , then send in an AJAX request for a paricular option.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have thousands of HTML files to process using Groovy/Java and I need to
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

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.