Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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?