Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How do I pre-select specific values from a dynamically populated dropdown list for HTML form

<form class="uploadDataForm" action="/mapping2/{{ id }}" method = "POST">

{% for fetchcol in db_col %}

    <label for="{{ fetchcol }}">{{ fetchcol }}</label>
    <select class="form-select" name="{{ fetchcol }}" id="fetchcol{{ loop.index }}" onclick="changeColumnCol{{ loop.index }}(this.value)" >

        {% for ex_col in df_list %}
            {% if ex_col == smart_mapping_dict[fetchcol] %}
                <option value="{{ ex_col }}" selected>{{ ex_col }}</option>
            {% else %}
                <option value="{{ ex_col }}">{{ ex_col }}</option>
            {% endif %}
        {% endfor %}

    </select>
    <br>
    {% endfor %}

    <div class="text-center">
        <a href="/second_page/{{ id }}" class="btn btn-danger">Discard Data Tape</a>
        <button class="btn btn-default nextBtn text-center ">Next</button>
    </div>

</form>
Comment

PREVIOUS NEXT
Code Example
Python :: Flask select which form to POST by button click 
Python :: sklearn encoding pipelin 
Python :: plot bar 
Python :: Flask - how do I combine Flask-WTF and Flask-SQLAlchemy to edit db models 
Python :: Converting Data Types 
Python :: win10 python com ports 
Python :: Python (cpython 2.7.16) sample 
Python :: django add list to manytomany 
Python :: python without creating pyc 
Python :: knn.score sklearn 
Python :: ring Do Again Loop 
Python :: ring write the same example using normal for loop the Encrypt() and Decrypt() functions. 
Python :: text to ascii art generator python 
Python :: python graph 
Python :: How to Load Any HuggingFace Model in spaCy 
Python :: circular ImportError: cannot import name 
Python :: numpy mask without losing shape 
Python :: how to know google index of a page using python 
Python :: Find dataframe column values containing a certain string 
Python :: get picamera feed 
Python :: x not defined python 
Python :: Capitalize first word of a phrase in python 
Python :: how to code a jumping function in python 
Python :: arima A date index has been provided, but it has no associated frequency information and so will be ignored when e.g. forecasting 
Python :: blakyubeuiwbciwcqiby7ib.py 
Python :: colab erase recycle bin drive 
Python :: django celery email 
Python :: fill missing values with meadian in df 
Python :: google.api_core.exceptions.ServiceUnavailable: 503 The datastore operation timed out, or the data was temporarily unavailable when using stream 
Python :: save media file from url python 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =