plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

How to program an Action to reset several mult-select fields to emplty #785

Closed allnode closed 7 years ago

allnode commented 7 years ago

I have a search form that have many selectable fields. I'd like to provide a "Reset Button" to allow the user to empty out the selections. What is the python code to do that.

Here is link my form http://dmcbeam.org/olmsted-county-community-health/frmWideSearchGeneralFront

ebrehault commented 7 years ago

There is no Python code for that, moreover it would not make sense to submit a page in order to get an empty form in return. It must be done in javascript, like this: $('#plomino_form')[0].reset()

It can be embedded in a button produced with a computed for display rich text field:

html = """<button onclick="$('#plomino_form')[0].reset(); return false;">Reset</button>"""
return html
allnode commented 7 years ago

Thank you. It works.