Basically I have a for loop to generate N buttons. Each button has a name and an id to recognize the activity. When one of these buttons is clicked, a new HTML page is opened in order to display the info of that activity. I could open the page but I need to pass the value of the button or I won't know which activity was clicked. There must be a pattern to do this.
You can check the code here:
<div class="activities"> <h2>Activities</h2> {% set i = [0] %} {% for d in data %} <a href ="/activity"><button class="btn btn-info" style="margin: 10px;" value="{{ indexs[i[0]] }}">{{ d }}</button></a> {% if i.append(i.pop() + 1) %}{% endif %} {% endfor %} </div> @views.route('/activity') def activity(): return render_template("activity.html")
<button value="{{ indexs[i[0]] }}" class="btn btn-info" style="margin: 10px;" onclick="window.location.href='{{ url_for( 'activity' , activity_id='value' ) }}';">{{ d }}</button>