You can also test for the id value like so:
if (!isset($values['id']))
{
$fields['customer_name']['type'] = 'hidden';
$fields['customer_address']['type'] = 'hidden';
$fields['refund_transaction_id']['type'] = 'hidden';
$fields['refund_transaction_id']['type'] = 'hidden';
$fields['refund_type']['type'] = 'hidden';
}
else
{
// Set Specific Fields to Display Only
$fields['customer_name']['displayonly'] = true;
$fields['customer_address']['displayonly'] = true;
$fields['refund_transaction_id']['displayonly'] = true;
$fields['refund_transaction_id']['displayonly'] = true;
$fields['refund_type']['displayonly'] = true;
}
Comments
if(uri_segment(3) == 'create') { $fields['customer_name']['type'] = 'hidden'; $fields['customer_address']['type'] = 'hidden'; $fields['refund_transaction_id']['type'] = 'hidden'; $fields['refund_transaction_id']['type'] = 'hidden'; $fields['refund_type']['type'] = 'hidden'; } else { // Set Specific Fields to Display Only $fields['customer_name']['displayonly'] = true; $fields['customer_address']['displayonly'] = true; $fields['refund_transaction_id']['displayonly'] = true; $fields['refund_transaction_id']['displayonly'] = true; $fields['refund_type']['displayonly'] = true; }
if (!isset($values['id'])) { $fields['customer_name']['type'] = 'hidden'; $fields['customer_address']['type'] = 'hidden'; $fields['refund_transaction_id']['type'] = 'hidden'; $fields['refund_transaction_id']['type'] = 'hidden'; $fields['refund_type']['type'] = 'hidden'; } else { // Set Specific Fields to Display Only $fields['customer_name']['displayonly'] = true; $fields['customer_address']['displayonly'] = true; $fields['refund_transaction_id']['displayonly'] = true; $fields['refund_transaction_id']['displayonly'] = true; $fields['refund_type']['displayonly'] = true; }