• DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        Sending data from a html non-input to Flask

        1.7k Views Asked by kochenderKoch At 17 December 2017 at 22:15 2025-12-08T15:18:32.670995

        how can i send non-input data (like lists) from html to Flask.

        <form action="/" method="POST"> 
          <ul class="list-group">
            <li class="list-group-item " id="">Data that i want to receive 1</li>
            <li class="list-group-item " id="">Data that i want to receive 2</li>
            <li class="list-group-item " id="">Data that i want to receive 3</li>
          </ul>
          <input name="send" type="submit" value="Send">
        </form> 

        with request.from i only receive the button informations in python, but i want the data from the list. What i have to do, that i can get the list-data?

        javascript python html flask request.form
        Original Q&A
        1

        There are 1 best solutions below

        0
        waterproofpatch waterproofpatch On 17 December 2017 at 22:28 BEST ANSWER

        HTML forms only send along <input> tagged values to the remote endpoint when a "submit" input is pressed. You have three list elements, but only one "input" element - the submit button.

        Try putting the other elements you want to be sent up with the form in "input" tags, with appropriate types, and 'name' attributes identifying how the values will be extracted in processing code:

        <form action="/" method="POST"> 
        <ul class="list-group">
            <li class="list-group-item">
                <select name="my_select"> <!-- *NOTE* the select field, with options in a dropdown -->
                    <option value="val1">Value 1</option>
                    <option value="val1">Value 2</option>
                    <option value="val1">Value 3</option>
                </select>
            </li>
            <li class="list-group-item">
                <input type="text" name="data_2" placeholder="Data that I want to receive 2"></input>
            </li>
            <li class="list-group-item">
                <input type="text" name="data_3" placeholder="Data that I want to receive 3"></input>
            </li>
            <li class="list-group-item">
                <input name="send" type="submit" value="Send"></input>
            </li>
        </ul>
        

        The tag you're probably looking for to achieve your 'list' goal is 'select'. Select has 'option' children that are the available choices from a dropdown list.

        There are other input types than "text"; see https://www.w3schools.com/html/html_forms.asp for a concise basic rundown of how HTML forms work.

        Edit: cleaned up some formatting; added placeholder value, added list dropdown after re-reading OP question.

        Related Questions in JAVASCRIPT

        • Angular Show All When No Filter Is Supplied
        • Why does a function show up as not defined
        • I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
        • Set "More" "Less" font size
        • Using pagination on a table in AngularJS
        • How to sort these using Javascript or Jquery Most effectively
        • how to fill out the table with next values in array with one button
        • State with different subviews
        • Ajax jQuery firing multiple time display event for the same result
        • Getting and passing MVC Model data to AngularJS controller
        • Disable variable in eval
        • javascript nested loops waiting for user input
        • .hover() seems to overwrite .click()
        • How to sort a multi-dimensional array by the second array in descending order?
        • How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?

        Related Questions in PYTHON

        • new thread blocks main thread
        • Extracting viewCount & SubscriberCount from YouTube API V3 for a given channel, where channelID does not equal userID
        • Display images on Django Template Site
        • Difference between list() and dict() with generators
        • How can I serialize a numpy array while preserving matrix dimensions?
        • Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
        • Why is my program adding int as string (4+7 = 47)?
        • store numpy array in mysql
        • how to omit the less frequent words from a dictionary in python?
        • Update a text file with ( new words+ \n ) after the words is appended into a list
        • python how to write list of lists to file
        • Removing URL features from tokens in NLTK
        • Optimizing for Social Leaderboards
        • Python : Get size of string in bytes
        • What is the code of the sorted function?

        Related Questions in HTML

        • Delay in loading Html Page(WebView) from assets folder in real android device
        • Why does a function show up as not defined
        • CSS Class is not applying to element (border width,color,and style attributes)
        • How to sort these using Javascript or Jquery Most effectively
        • how to fill out the table with next values in array with one button
        • Automatically closing tags in form input?
        • Positioning child at bottom of parent with scroll
        • Remove added set of rows
        • Website zoomed out on Android default browser
        • Twitter Bootstrap horizontal form elements on a line
        • http://sigmajs.org/ les mis tutorial - why are my canvases 0 height?
        • My navbar is not expanding after collapse
        • when a checkbox is checked how to display a different hidden element using javascript
        • Gaps Vertically Using Dividers
        • Svg containers not positioning properly

        Related Questions in FLASK

        • Executing database query gives "TypeError: not all arguments converted during string formatting"
        • Flask custom "not found" code
        • Python Flask shutdown event handler
        • HTML call that triggers daemon subprocess
        • Any way to use jinja2 and flask form instead of ajax and jquery or both?
        • Deploying flask app on gunicorn, module object has no attribute
        • Flask-Restful, oauth, and Salesforce
        • Why doesn't my WTForms-JSON form update correctly?
        • Apply different stylesheets to different elements of a template
        • Flask server to notify webclient when changes occur
        • How to let a Reference Field accept multiple Document schemas in MongoEngine?
        • Creating 2 dimensional array in Python Flask application Jinja2 Template
        • How to do a custom query in Model View on *-to-Many relationship in Flask Admin?
        • Syntax error python 2.7
        • Load image using $resource in AngularJS

        Related Questions in REQUEST.FORM

        • How can I use HTML5 Request.Form to get list values?
        • Difference between Request.Form and Request.QueryString?
        • ASP.NET: Using Request["param"] versus using Request.QueryString["param"] or Request.Form["param"]
        • How do I get the form value that caused the "A potentially dangerous Request.Form value was detected from the client" in MVC?
        • How to read input value from the Request.Form collection by input name
        • Why does my data come from request.form when passing it to the backend in Flask, python?
        • Is there any way to get form data from multiple forms in flask?
        • Request.Form ASP not Working
        • Request.Form between HTTP and HTTPS pages in ASP.NET
        • Object reference not set to an instance of an object in Request.Form["ElementName"]
        • How to get Request.Form["elementName"] of an element while it has the attribute runat="server"?
        • What is TryParse and Request.Form doing in this line of C# code?
        • Parsing HTML Input to C# code on Page Load
        • Try to access Request Form Post data from ActionFilterAttribute throw A potentially dangerous Request.Form value was detected from the client
        • Sending data from a html non-input to Flask

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Math
        • Aftereffectstemplates