So, I have a Bottle page within PythonAnywhere that is displaying a list of items in my SQLite database. In each of those tappable items, I want to give the other page relevant information from the database based on the name of the list item that was clicked.
So in this case, I want to grab the value of this element and use the variable in my SQLite query via Python.
<ons-list-item id="itembtn" name="itembtn" value="{{ record [0] }}" tappable>
However, it is to my knowledge that the value of an HTML element isn't possible to retrieve. I am wondering if anyone knows of a way to grab this dynamic value with Python.
<!-- Parts showing from database -->
<template id="caseFanResult.html">
<% result = c.execute("SELECT * FROM caseFanPart")%>
<ons-page id="caseFanResult">
<ons-toolbar>
<div class="left">
<ons-back-button>Back</ons-back-button>
</div>
<div class="center">Case Fan Parts</div>
</ons-toolbar>
<ons-list modifier="material">
%for record in result:
<ons-list-item id="itembtn" name="itembtn" value="{{ record [0] }}" tappable>
<div class="center">
<span class="list-item__title">{{ record[1] }}</span>
<span class="list-item__subtitle">{{ record[2] }}</span>
</div>
</ons-list-item>
%end
</ons-list>
</ons-page>
</template>
<!-- Parts detailed spec sheet -->
<template id="itemResult.html">
<%
id = request.form.get("itembtn","")
itemResult = c.execute("SELECT * FROM caseFanPart WHERE caseFanID = ?", (id,))
%>
<ons-page id="itemResult">
<ons-toolbar>
<div class="left">
<ons-back-button>Back</ons-back-button>
</div>
<div class="center">Spec Sheet</div>
</ons-toolbar>
<ons-list modifier="material">
%for item in itemResult:
<ons-list-header>{{ item[1] }}</ons-list-header>
<ons-list-item>Price: {{ item[2] }}</ons-list-item>
<ons-list-item>Rating: {{ item[3] }}</ons-list-item>
<ons-list-item>Color: {{ item[4] }}</ons-list-item>
<ons-list-item>Size: {{ item[5] }}</ons-list-item>
<ons-list-item>RPM: {{ item[6] }}</ons-list-item>
<ons-list-item>Airflow: {{ item[7] }}</ons-list-item>
<ons-list-item>Noise Level:{{ item[8] }}</ons-list-item>
%end
</ons-list>
</ons-page>
</template>