I'm having an issue with a my post updating when I have a required field that is hidden Conditional Logic. The field shows when a choice is selected in dropdown. How can I get this to work?
Here is how it works:
I have a required select_advanced field called Status with 3 options: Available, Under Contract and Sold. I have another required field called Sold Price and only shows if "Sold" is selected in the Status field. Since my Sold Price field is required and hidden, I can't update my post without having validation issues.
Code:
// Start Fields
'fields' => array(
// SELECT ADVANCED - Status
array (
'id' => $prefix . 'status',
'name' => 'Status',
'type' => 'select_advanced',
'placeholder' => 'Select Status',
'options' => array(
'Available' => 'Available',
'UnderContract' => 'Under Contract',
'Sold' => 'Sold',
),
),
// TEXT - Sold Price
array (
'id' => $prefix . 'sold_price',
'type' => 'text',
'name' => 'Sold Price',
'prepend' => '$',
'hidden' => array( $prefix . 'status', '!=', 'Sold' )
),
), // End Fields
// Start Validation
'validation' => array(
'rules' => array(
$prefix . 'staus' => array(
'required' => true,
),
$prefix . 'sold_price' => array(
'required' => true,
),
),
) // End Validation