Function Detail

Function Name:get_entry_metas_for_field
Declaration:
public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() )
Basic usage:
In class:
Location:
formidable/classes/models/FrmEntryMeta.php
Pro function:
No

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;
}