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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:25:42+00:00 2026-06-09T18:25:42+00:00

Currently I have a drop down box with all the options. After submit is

  • 0

Currently I have a drop down box with all the options. After submit is pressed, the page is reloaded with all the selected variables in the url

http://127.0.0.1:8000/website/?var1=choice1&var2=choice3

So the same view is reloaded and the variables are collected and analysed by the view. Based on the selection, different data from the database is sent to this webpage page, thus making different tables load underneath this dropdown menu.

Is it possible to show the selected data in the form after the refresh? Something like this:
My current site

So far I’ve only used HTML. I thought that perhaps using jQuery I could get this to work, but the language is perplexing (though I’m very willing to learn, if someone knows how to do it with jQuery)

SOLUTION

Under Chris’ instructions, I managed to make this to work.
First of all, what didn’t work with Chris’ solution was the request.GET method. Therefore, inside the VIEW that calls return render_to_response('website.html') (so the corresponding view), I added the following piece of code:

requestDict = request.GET

return render_to_response('optionset.html', {'request':requestDict}) 

Inside my template therefore, I did the following:

<form action="" name="OptionSetForm">
     <select name="var1" size=2>
     <OPTGROUP LABEL="FirstPickHere">
            <option {% if request.var1 == "Choice1" %} selected="selected"{% endif %}>Choice1</option>
            <option {% if request.var1 == "Choice2" %} selected="selected"{% endif %}>Choice2</option>
            <option {% if request.var1 == "Choice3" %} selected="selected"{% endif %}>Choice3</option>
    </OPTGROUP>
    </select>
</form>

Make sure that you have spaces between the == and the two variables.

  • 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-09T18:25:43+00:00Added an answer on June 9, 2026 at 6:25 pm

    Since you’re using select boxes, you’ll need to add the following to each option:

    <option value="choice1"{% if request.GET.var1 == "choice1" %} selected="selected"{% endif %}>Choice 1</option>
    

    Or, if you’d rather use jQuery:

    var queryString = window.location.search.substring(1);
    var params = queryString.split('&');
    for (var i=0; i<params.length; i++) {
        var param = params[i].split('=');
        $('[name='+param[0]+']').val(param[1])
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my rails app, i have a drop down box where i retrieve all
Currently have a drop down menu that is activated on a hover (from display:none
I am trying to obtain all the values stored in a list box/drop down
I currently have a dropdown box which contains a list of all of the
So the problem I am currently having is that I have A drop down
I currently have a drag and drop system for images where you drag a
The OnSelectedIndexChanged event is not firing for my dropdown box. All forums I have
I am currently implementing a form in CodeIgniter that needs to have a drop
So I have two filtering objects. One is a drop down list, which chooses
I'm trying to create a select box drop down with a twist, Basically this

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.