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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:43:37+00:00 2026-05-11T01:43:37+00:00

How to get the text of selected item from a drop down box element

  • 0

How to get the text of selected item from a drop down box element in html forms? (using python) How can I store the value to a variable, when I select one item from the drop down box using mouse? (ie. without using a submit button)

This is for a application which I am doing in app engine which only supports Python.

  • 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. 2026-05-11T01:43:37+00:00Added an answer on May 11, 2026 at 1:43 am

    Your question shows some misunderstanding on how web applications work.

    The user has to type an address in a browser to get to the application. That sends a request to the server. The server code (written in python) receives this request and has the opportunity to send an answer. The answer is a document usually written in HTML. Some parts of this document can be dynamic, i.e. generated by the python code. Other parts of the document can be static. The browser then renders the document on the user window.

    After that, the only single way your python code can know about something that happens on the browser window, or to run any part of the python code, is to make the browser send another request.

    That can happen in many situations, the most common being:

    • User clicks on a link to another url, making browser send another request to this new url.
    • User clicks on submit button, making browser submit the form as a request to the address configured in the form’s action attribute.
    • Some code in the actual page, usually written in ECMAscript (also known as javascript), makes a request under the hood.

    The latter is what you want. You must write in javascript some code to make the browser send the information choosen in the drop down to the server. That way your python code on the server can do something about it.

    The simple way to do that is by making the onchange event of the drop down do a submit:

    <select name='myfield' onchange='this.form.submit()'> <option .... > ... </select> </form> 

    That way, when the user changes the value on the dropdown, the form will be submited as if the user clicked on submit. Python code on the server will run. The browser will load the answer.

    Another popular way would be to use javascript’s XmlHTTPRequest DOM API to send the request. That way you can receive the value in python and send an answer, which in turn will be received by the javascript code in the browser. That code can change parts of the page based on the answer, without changing the entire page. This technique is called AJAX.

    If you plan to write lots of javascript code, I strongly suggest using a javascript library at least to ease the pain of dealing with many browser versions. jQuery is my library of choice.

    In other words, code written in javascript running in the browser talks to the code written in python running in the server.

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

Sidebar

Related Questions

How can I get the text of the selected item from a dropdown using
How do I get the actual value (or text) of the item selected in
When I print "\[\e[34m\]sometext" I get some text in blue, but can I specify
I have a database which is in Access (you can get it link text
How can I get an application to write debug text to the Event Log
If I have a text field with SWT, how can I get the field
I'm trying to create a select box drop down with a twist, Basically this
I am populating combo box from database. In debug i can see that the
I want to get the header of a selected tab-item of a tab-control and
How to retrieve the items from the selected item of a listview ? [multiselect

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.