Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lfittl/condition-fields-js

Make form fields for AND/OR conditions that are stored as JSON in your database.
https://github.com/lfittl/condition-fields-js

Last synced: 21 days ago
JSON representation

Make form fields for AND/OR conditions that are stored as JSON in your database.

Awesome Lists containing this project

README

        


condition-fields.js





condition-fields.js



A helper library to make form fields for AND/OR conditions in queries/reports that are stored as a JSON field in your database.


Usage



For example, lets say your customer wants to create a report where the elements are either is_valid and is_index, or which are marked as always_show.



The data would be stored and output by you like this:



<input type="hidden" name="conditions" value="[{'is_valid': 'true', 'is_indexed': 'true'}, {'always_show': 'true'}]" />


condition-fields.js then turns it into:






$('#test').conditionFields();


After each data change the conditions hidden field is updated, so you can use standard form submission without worry.


License & Copyright



Licensed under MIT license.


Copyright © 2013, Lukas Fittl <[email protected]>