Sto cercando di utilizzare le checkbox nel mio HTML, restituire queste checkbox al mio backend python e quindi incrementare tre contatori se si fa clic sulla casella.Come prendere caselle di controllo in Python
questo momento il mio HTML è il seguente e funziona bene:
<form method="post">
<input type="checkbox inline" name="adjective" value="entertaining">Entertaining
<input type="checkbox inline" name="adjective" value="informative">Informative
<input type="checkbox inline" name="adjective" value="exceptional">Exceptional
</form>
e poi sul mio pitone backend Ho il seguente:
def post(self):
adjective = self.request.get('adjective ')
if adjective :
#somehow tell if the entertaining box was checked
#increment entertaining counter
#do the same for the others
Penso che forse rendono il nome in html "aggettivo []" ... forse ... –
ti conosco si può semplicemente 'aggettivo stampa 'per vedere cosa c'è lì dentro, giusto? Finirà per mescolare con il tuo codice HTML, ma puoi semplicemente vedere il sorgente per dare un'occhiata ... – kindall
@kindall che sarebbe buono per il debug ma ho bisogno di farlo programmaticamente in modo che funzioni ogni volta sul backend – clifgray