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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:04:00+00:00 2026-06-07T02:04:00+00:00

I have a value stored in Google App Engine datastore, selected from a dropdown

  • 0

I have a value stored in Google App Engine datastore, selected from a dropdown select control.

But every time I load the html page, it does not show me the stored datastore value. Instead it shows the original dropdown select with no option selected.

HTML:

<select name="items">
  <option>Select</option>
</select>

JavaScript:

(function($) {
    $.fn.changeType = function() {
        var data = [{"user":"a","name":"Mr A"},
                    {"user":"b","name":"Miss B"},
                    {"user":"c","name":"Mrs C"}];
        var tlist = '<option>Select<\/option>';
        $.each(data, function(i,d){
            tlist += '<option value="' + d.user + '">' + d.name + '<\/option>';
        });
        $("select", this).html(tlist);
    };
})(jQuery);

main.py:

# assume model s
user = db.StringProperty()
...
updated_user = self.request.get('items')
s.user = updated_user
s.put()

Note that I only store the user (value) part (eg a) in the datastore, but I would like to have the name part (eg Mr A). Is this possible?

Many thanks!

Update:
Sorry for not being clear. I was using jinja2 with a template value p which draws from the model s

<select name="items">
    <option>{{ p.user }}</option>
</select>

and also tried putting this in the jQuery:

var tlist = '<option>{{ p.user }}<\/option>';

but there was no effect (well it sort of shows the user (value) part for a split second). Essentially I would like to ask what and where do I put the Google App Engine datastore value in my HTML and jQuery. Thanks.

Update 2:
I changed the JavaScript to

(function($) {
    $.fn.changeType = function() {
        var data = [{"user":"a","name":"Mr A"},
                    {"user":"b","name":"Miss B"},
                    {"user":"c","name":"Mrs C"}];
        var tselected = $("select option:selected").val();
        var tlist = '<option>Select<\/option>';
        $.each(data, function(i,d){
    if (d.user === tselected)
                tlist += '<option value="' + d.user + 'selected="selected">' + d.name + '<\/option>';
            else
                tlist += '<option value="' + d.user + '">' + d.name + '<\/option>';
        });
        $("select", this).html(tlist);
    };
})(jQuery);

but tselected does not appear to return the current selected value. Any ideas? Thanks.

  • 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-07T02:04:02+00:00Added an answer on June 7, 2026 at 2:04 am

    Solved using input hidden value.

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

Sidebar

Related Questions

In Google App Engine the datastore creates a new entry every time you assign
In a Python Google App Engine app I'm writing, I have an entity stored
I have a String that represents a time value and is stored in the
I'm using Google App Engine and thus Big Table. I have a person entity
I have stored data in the gae datastore, but when I query the data
I have a Java Google App Engine web application that allows user upload of
I have used this tutorial from Google to build a web app that finds
I'm converting a D2006 program to D2010. I have a value stored in a
I have a pretty basic doubt on dirty read/writes to a value stored in
I have a variable newItem. I want to place the value stored in newItem

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.