Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Mayur Pande
PLUS
Mayur Pande
Courses Plus Student 11,711 Points

Is there a way in flask that I can save all data on a page with one button click

I currently have a form set up to display multiple ul elements within the ul element I have different data and a checkbox for each ul what I want to achieve is to be able to check a checkbox. Then at the end click a button save changes which post all the data.

However currently at the moment it only posts the first set of data from the first ul

My html code looks like this;

<form action='/' method="post">
     {% for x in data %}
          <ul>
               <li>{{ x.title }}</li>
               <li>{{ x.company }}</li>
                <li><input type="checkbox" value="is relevant" /></li>
          </ul>
     {% endfor %}
     <input type="hidden" value="{{ x.title }}" />
     <input type="hidden" value="{{ x.company }}" />
     <input type="submit" value="Save Changes" /> 
</form>

But on the flask side I can only get the code from the first ul I want to be able to retirieve all data from the uls that have been checked. Is this possible?