Filter Detail

Filter Name:FrmProFieldSettings
Declaration:
Filter Type:
In class:
Location:
formidable-pro/classes/models/FrmProFieldSettings.php
Pro function:
Yes

Contribute Comments or Examples

Codex Comments/Examples
First
Last
Mastermind Contributor: Lisa Thrower

At the risk of doubling up (also posted on the filter) I thought I'd share a useage for this function in a filter. It is one someone asked for help with in the slack group. It adds field validation to make sure the user is entering a higher value than any previously entered. It uses FrmEntryMeta::get_entry_metas_for_field to get the existing entry values.

add_filter('frm_validate_field_entry', 'require_higher_bid', 10, 3);
function require_higher_bid($errors, $posted_field, $posted_value){
if ( $posted_field->id == 25 && $posted_value != '' ) { //change 25 to the ID of the field to change
$previous_bids = FrmEntryMeta::get_entry_metas_for_field( $posted_field->id ) ;//returns all of the meta values of the existing entries in this field as an array.
$high_bid = max($previous_bids); //sets the high_bid variable as the highest value in the previous_bids array
if ($posted_value id] = 'Looks like you have been outbid! Raise your bid and try again!';
}
return $errors;
}

Mastermind Contributor: Lisa Thrower

I helped someone with this in the slack group so thought I would put it here as well. It adds field validation to make sure the user is entering a higher value than any previously entered. It uses FrmEntryMeta::get_entry_metas_for_field to get the existing entry values.

add_filter('frm_validate_field_entry', 'require_higher_bid', 10, 3);
function require_higher_bid($errors, $posted_field, $posted_value){
if ( $posted_field->id == 25 && $posted_value != '' ) { //change 25 to the ID of the field to change
$previous_bids = FrmEntryMeta::get_entry_metas_for_field( $posted_field->id ) ;
$high_bid = max($previous_bids);
if ($posted_value id] = 'Looks like you have been outbid! Raise your bid and try again!';
}
return $errors;
}