Dependent field setup based on multiple fields
Dependent field setup based on multiple fields

Hi,
All the dependent api examples pull in one fields value and then you make decisions based on it that can effect other fields.
Is it possible to bring in multiple fields to do more complex checks, i.e. hide fields until at least 1 of 3 fields has a value in it?
Anyone have an example to refer to of this type of thing working?
Thanks!
Brian
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I haven't tried it but it looks like the
field
parameter of thedependent()
API can be either a string or an array of fields.Kevin
Thanks Kevin, looks like you are right, will have to give a try. Do you then call the specific val of the member of the array you are currently looking for? i.e. field1.val field2.val, field3.val
I find it interesting that I can't find any examples of something like this, surprised more people don't run into it.
Yep, agreed, I'll update the docs with an example of this. The value will be any one of those in the array that changed (only one can change at a time) - you can then use
data.values
to get the values of the entire record. Hopefully this example here will make that clear.Colin
Perfect, thanks Colin, giving it a go now but seems pretty straight forward.
Thanks,
Brian