Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I redisplay the same dropdown list with the previous selection instead of the default selection?
    primarykey
    data
    text
    <p>I have two dropdown lists. If the user only selects something from one selection box, I want to re-render the page where it has the same dropdown lists, except the one that was selected shows the previous selection instead of the default selection. </p> <p>the html looks like</p> <pre><code>&lt;div&gt; &lt;select name = "menu" value = "{{menu}}"&gt; &lt;option value = "selected"&gt;select something&lt;/option&gt; &lt;option value = "a"&gt;a&lt;/option&gt; &lt;option value = "b"&gt;b&lt;/option&gt; &lt;option value = "c"&gt;c&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div&gt; &lt;select name = "location" value = "{{location}}"&gt; &lt;option value = "selected"&gt;select something&lt;/option&gt; &lt;option value = "d"&gt;d&lt;/option&gt; &lt;option value = "e"&gt;e&lt;/option&gt; &lt;option value = "f"&gt;f&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>the python looks like menu = self.request.get('menu') location = self.request.get('location')</p> <pre><code> if menu!="selected" and location!="selected": d = Delivery(parent = delivery_key(), menu = menu, location = location) d.put() deliverystatus = "success" self.render('page.html', deliverystatus = deliverystatus, menu = menu, location = location) else: error = "please select something from both lists" self.render("page.html", menu = menu, location = location, error = error) </code></pre> <p>When there is an error and I rerender the page I get "select something" as the default in both boxes. How do I change this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload