Open borisvanschooten opened 5 years ago
One major limitation I'veexperienced with Alpaca is, it's not possible to check if a value is, for example, > n.
I have to list all the numbers i.e. [0,1,2,3,4,5,6,7,8,9,...] . Not much good if the number is in the thousands!
Are you able to add this functionality into this at all?
@ricardoee it shouldn't be too hard to add < <= > >= comparisons. I don't need them for my project though. I don't see much point in putting work in it if the pull request weren't accepted.
The Copy function adds some basic copy/paste functionality to array fields.
Dependencies (having one field appear only if another field has a specific value) are essential to how I use forms in my application. The existing Alpaca dependency facilities have serious limitations and are not easy to specify. So, I created a new dependency system that is both powerful and concise. Dependencies are specified as part of the options json, using a separate field "x_dependencies". This is an array of objects, with the following fields:
"field" : path to field that is to be checked (no leading slash). Use "[]" to indicate all elements of an array.
"values": array of values against which field is checked.
"enables": array of relative paths to fields that are to be enabled when field is equal to one of the values. The path root is the parent of the element indicated by field. So, dependencies can refer to siblings of the field element, or to elements deeper in the tree. "[]" can again be used to specify all elements of an array.
Example.
This checks if the type field of each element of the questions array is equal to either of the two given strings. If true, the range field in the same element and the desc.nld_nld.anchors subfields are enabled. If false, they are disabled (hidden).
The current system is limited to showing and hiding fields. No form validation is performed.