Opel_Corsa
04-14-2007, 04:09 AM
I have a number of checkboxes in my form and I want to submit the values of the checked ones with my form. I am coding in Python.
I was thinking of having a hidden field that can be populated with the checked values through a Jscript. But I can't figure out how to trigger the Jscript as the submit button does something non-related to Jscript (it submits the form values to the SQL db). Here's how my Submit button looks like:
<input type="button" value="Update" onclick="this.form.action.value='pscn_update'; this.form.submit()">
Then in another function in the Python code I direct all calls to "pscn_update" to another Python function update_pscn() (i.e. if action == "pscn_update" then call update_pscn()). The function then reads and submits the values entered in all the text fields to the SQL db.
Any help is appreciated. I'm mostly looking for the best and most ideal way of doing this; i.e. not necessarily focusing on my proposed method.
I was thinking of having a hidden field that can be populated with the checked values through a Jscript. But I can't figure out how to trigger the Jscript as the submit button does something non-related to Jscript (it submits the form values to the SQL db). Here's how my Submit button looks like:
<input type="button" value="Update" onclick="this.form.action.value='pscn_update'; this.form.submit()">
Then in another function in the Python code I direct all calls to "pscn_update" to another Python function update_pscn() (i.e. if action == "pscn_update" then call update_pscn()). The function then reads and submits the values entered in all the text fields to the SQL db.
Any help is appreciated. I'm mostly looking for the best and most ideal way of doing this; i.e. not necessarily focusing on my proposed method.