Hello, I am developing an application, and I have a structure that displays a JSON Modal. Based on my chosen list, I want to display a field. However, the issue is that I want to return an element based on the chosen element in the list using equals
But equals
only returns a string of characters? I tried to do this, but I get an error with equals
:
"block_key_phone" => [ "visibleOn" => [ "block_key_process" => [ "equals" => array_map(function ($template) { return [ "label" => $template->collect_phone, "value" => $template->id ]; }, $templates) ] ], "value" => "" ],
Is it correct? I would like to return an element from an array.
Hello @Romain,
You are right, equals
expects to receive only a string. If you want to display block_key_phone
block only on a specific value on block_key_process
change, then there is an option to use fetchOnChange
Component library.
I.e. when the value of block_key_process
is changed, there will be a request made to your endpoint, where you can return visibleOn: “never“
for block_key_phone
in case it’s not needed to be displayed.
Let me know if that works for you and don’t hesitate to ask any following questions.
Best regards,
Pavlo
This topic was automatically closed after 60 days. New replies are no longer allowed.