August 8, 2018 at 6:35 pm #9196
I noticed that the field conditions don’t work, when they depend on hidden field’s value.
The situation is, I have a plugin, which I am writing a settings page for. The Workflow has multiple tabs, the first tab allows the user to enable/disable this plugin by clicking a checkbox field called “enabled”. And since I couldn’t find a way to directly “hook” into the “enabled” field from other workflow tabs, I was thinking to use a hidden field and populate the value of this field dynamically on every page load. This is what I had:
$plugin_settings = get_option( 'plugin_settings' ); piklist( 'field', array( 'type' => 'hidden', 'field' => 'is_enabled', 'value' => ( array_key_exists( 'enabled', $plugin_settings ) && $plugin_settings['enabled'] == 'true' ), ) ); piklist( 'field', array( 'type' => 'text', 'field' => 'dependent_field', 'label' => 'Dependent Field', 'conditions' => array( array( 'field' => 'is_enabled', 'value' => true, 'reset' => false, ), ), ));
But it doesn’t work. It only works, if the “is_enabled” is not of type “hidden”. Is this a bug or an expected behaviour?
Also, does anyone know how else I can hide fields based on other filed’s value from another workflow tab? Or, even better, how can I hide entire Wokflow tabs, based on Setting field value?
August 20, 2018 at 2:09 pm #9199
Alex– You can filter the comment block any Piklist
partby using the
This tutorial uses this filter to add the user role “no-role” is certain conditions apply. You can do the same with Workflow tab.
September 6, 2018 at 6:01 pm #9212
Thanks for pointing that out! That seems to be what I was looking for so far. Do you perhaps have a code snippet that does what I am looking for (i.e. hide tabs based on Piklist settings page value)?
Also, what about the dependency on hidden fields? Is this expected behaviour or did I stumble onto a bug?
You must be logged in to reply to this topic.