On the example you can see how to get the value for a field:
$value = rgpost( 'input_2' );
The above would get the value for a single input field with an id of 2 (e.g. a single line text field or number field).
So using that example, if you want to know if the field was filled, you can simply check if the field is not empty using PHP’s is_empty() function. Example:
if ( ! empty( rgpost( 'input_2' ) ){
// Field is not empty.
}
Hi, sorry for the delay. Thanks for the answer!
In my example i use rgpost($field->adminLabel) to get the name of the field, is this correct or should i use other parameter?
The function rgpost() is only to get field values from the POST request.
$field->adminLabel has no relation with the field value, that’s for getting the Field Admin Label (not the regular field label, that would be $field->label ). If you really want to check that, then you would use $field->adminLabel without the rg_post() function, example:
if ( ! empty( $field->adminLabel ){
// Field Admin Label is not empty.
}