Hello.
I have a snippet that will make a field read only base on the value of another field on the same form
add_filter(\'frm_setup_new_fields_vars\', \'frm_set_read_only_on_create\', 9, 2);
add_filter(\'frm_setup_edit_fields_vars\', \'frm_set_read_only_on_create\', 9, 2);
function frm_set_read_only_on_create( $values, $field ){
$entry_id = FrmAppHelper::get_param(\'id\', 0, \'get\'); // Get the entry ID from the URL
$text_field_id = 805; // ID of the text field to check
$text_field_value = FrmEntryMeta::get_entry_meta_by_field($entry_id, $text_field_id, true);
if ($text_field_value == 5) {
$readonly_fields = array(409); // IDs of the text fields to make read-only
if (in_array($field->id, $readonly_fields)) {
$values[\'read_only\'] = true;
}
}
return $values;
}
The code is working fine during the edit mode and after submitting the form the code works fine.
The problem is when i open the form using the editlink shortchode, the code is not applying the read only even the value of the field is equal to 5.
Can you help what am i missing.
Thanks.