- This topic has 1 reply, 2 voices, and was last updated 5 years, 10 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Support Home » Topics » Piklist » Conditionally hide field based on selected user role?
How do I conditionally hide a field based on the selected user role in the user edit form?
I’ve added the following field, which should show/hide in regards of if the user role is ‘client’ or not:
piklist(‘field’,array(
‘conditions’ => array(array(
‘field’ => ‘role’,
‘value’ => ‘client’,
‘reset’ => ‘false’
)),
‘type’ => ‘group’,
‘field’ => ‘end_saldos’,
‘label’ => __( ‘End Saldos’, ‘toggle’ ),
‘add_more’ => true,
‘fields’ => array(array(
‘type’ => ‘datepicker’,
‘field’ => ‘end_date’,
‘label’ => __( ‘Date’, ‘toggle’ ),
‘columns’ => 4
), array(
‘type’ => ‘number’,
‘field’ => ‘end_saldo’,
‘label’ => __( ‘Saldo’, ‘toggle’ ),
‘columns’ => 8
))
));
@mandelkind– You would need to create a hidden Piklist field named role, and pass the current users role to the that field.
Does that make sense?