Hi,
I have a repeater with many different subfields hidden by conditional logic (with different rules for each field). I want to add a true/false that, when on true, show all the fields of the repeater.
So what I could do is add a conditional logic rule to all the fields individually (OR “Show this field îf * true/false* value is equal to checked”) but that adds complexity unnecessarily.
What I could do instead is remove, via javascript, the class .acf-hidden and the attribute hidden from all fields in the group when the true/false is on true.
Questions :
The reason I want to show all the fields with a true/false is because I want all the values to be saved when updating the post (not because I want to see them all at the same time – I would actually hide most fields with a display:none)
– In the conditional logic features, what determines whether wordpress should save the value or not ? Is it the acf-hidden class, the hidden attribute or something else ?
– Could this little hack cause problems somehow? am I better off applying the conditional logic individually?
– Somehow, my javascript code removes the acf-hidden class, but it doesn’t work for the hidden attribute. Is there a problem with my code ?
$(".myrepeater div").removeClass("acf-hidden");
$(".myrepeater div").removeAttribute("hidden");
Thank you !