Remove option used variable times

add_filter(‘frm_setup_new_fields_vars’, ‘frm_remove_selected’, 20, 2); function frm_remove_selected($values, $field) { $quantity_field = ‘frm-inquantity‘; // change to the field key for the quantity field in the other form $signup_field = ‘frm-signup-item‘; // change to the field key of the dynamic field that should…Continue reading

Remove option after n submissions

add_filter(‘frm_setup_new_fields_vars’, ‘frm_remove_full_option’, 20, 2); function frm_remove_full_option($values, $field){ if ( in_array( $field->id, array( 426, 427, 428 ) ) ) { $submitted_values = FrmEntryMeta::get_entry_metas_for_field( $field->id ); if ( $submitted_values ) { // Break out multi-dimensional array for checkbox field values if (…Continue reading

Remove an option

add_filter(‘frm_setup_new_fields_vars’, ‘remove_field_option’, 30, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘remove_field_option’, 30, 2); function remove_field_option( $values, $field ) { if ( $field->id == 25 ) { // change 25 to your field id $options_to_remove = array( ‘12:00 PM‘, ‘12:30 PM‘ ); foreach ( $options_to_remove as…Continue reading

Change the blank option label in Dynamic field

add_filter(‘frm_setup_new_fields_vars’, ‘change_dynamic_blank_option’, 25, 2); function change_dynamic_blank_option($values, $field){ if ( in_array( $field->id, array( 100,101,102 ) ) ) {//Replace 100, 101, and 102 with the IDs of your Dynamic fields if ( empty( $values[‘options’] ) ) { return $values; } $values[‘options’][”] =…Continue reading

Order field options

add_filter(‘frm_setup_new_fields_vars’, ‘frm_reorder_options’, 30, 2); function frm_reorder_options($values, $field){ if ( $field->id == 125 ) {//Replace 125 with the ID of your field asort($values[‘options’]); // sort the values here } return $values; }Continue reading

Add user dropdown

add_filter(‘frm_setup_new_fields_vars’, ‘frm_populate_user_dropdown’, 20, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘frm_populate_user_dropdown’, 20, 2); function frm_populate_user_dropdown( $values, $field ){ if ( $field->id == 485 ) { $role = ‘subscriber’; $users = get_users( array( ‘role’ => $role ) ); $values[‘options’] = array( ); foreach ( $users as…Continue reading

Set the default calendar year

add_action(‘frm_date_field_js’, ‘limit_my_date_field’); function limit_my_date_field($field_id){ if ($field_id == ‘field_FIELDKEY1‘ || $field_id == ‘field_FIELDKEY2‘){ //change FIELDKEY1 and FIELDKEY2 to the keys of your date fields echo ‘,defaultDate:”-20y“‘; } }Continue reading

Hide another field based on the selected date

add_action(‘frm_date_field_js’, ‘limit_my_date_field’); function limit_my_date_field($field_id){ $key_one = ‘FIELDKEY1‘; //Change FIELDKEY1 to the key of your date field $id_two = ‘FIELDID2‘; //Change FIELDID2 to the ID of your field to hide if($field_id == ‘field_’. $key_one){ echo ‘,onSelect:function(selectedDate,inst){ var theDate=new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay); var hideDate=new…Continue reading

Update the date when switching years

add_action(‘frm_date_field_js’, ‘update_date_value’); function update_date_value( $field_id ) { if ( $field_id == ‘field_FIELDKEY‘){ //change FIELDKEY to the key of your date field $date_format = ‘mm/dd/yy‘; // change this to the format of your date field ?> ,onChangeMonthYear: function (year, month, inst)…Continue reading

Display User ID dropdown on front-end for admin

add_filter(‘frm_setup_new_fields_vars’, ‘show_user_dropdown’, 15, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘show_user_dropdown’, 15, 3); function show_user_dropdown($values, $field, $entry_id=false){ $action = FrmAppHelper::get_param( ‘action’, ”, ‘post’, ‘sanitize_text_field’ ); $creating_field = FrmAppHelper::doing_ajax() && ( $action === ‘frm_insert_field’ || $action === ‘frm_duplicate_field’ ); if ( $values[‘type’] == ‘user_id’ && !…Continue reading