Looking for a price to create a lookup and validation on some existing code

By: Jason Ryan | Asked: 08/29/2023
ForumsCategory: General questionsLooking for a price to create a lookup and validation on some existing code
Jason Ryan asked 8 months ago

I have an entry form for office staff to create a "works order" which is in my form 6 and each entry has a drop-downbox option within the field 121  (with options of Completed, Partially Completed, Not Completed) Each form entry also receives a unique Job No. in field 113 in the same form. - ------------------------- I then have a secondary form for an engineer to fill out. Form 2 I added the code from the tutorial linked : https://formidableforms.com/knowledgebase/frm_after_create_entry/#kb-automatically-update-a-field-in-another-form However . . . after adding (and changing to my parameters)

add_action('frm_after_create_entry', 'link_fields', 30, 2);
add_action('frm_after_update_entry', 'link_fields', 10, 2);
function link_fields($entry_id, $form_id){
if($form_id == 2){//Change 2 to the ID of the first form
global $wpdb;
$first_field = $_POST['item_meta'][531]; //change 531 to the ID of the field in your first form
$user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ". $wpdb->prefix ."frm_items WHERE id=%d", $entry_id));
$entry_ids = $wpdb->get_col("Select id from ". $wpdb->prefix ."frm_items where form_id='6' and user_id=". $user);//Change 6 to the ID of the second form
foreach ($entry_ids as $e) {
$wpdb->update( $wpdb->prefix .'frm_item_metas', array('meta_value' => $first_field), array('item_id' => $e, 'field_id' => '121'));//Change 121 to the ID of the field to be updated automatically in your second form
}
}
}

I see that it updates every Entry in the original form under field ID 531 (with dropdown options of Completed, Partially Completed, Not Completed). Is there any additional code to be able to state only entries that match the unique job No. ??? So my original form with field 113 must match the number in the lookup in the second form . . . . field 110 ?? Looking for help with this

Jason Ryan replied 8 months ago

<p>Tried posting this in the "Paid Help category" but it defaulted to this category</p>

Victor Font replied 8 months ago

The best place to look for help is https://formidable-masterminds.com/developers-directory/

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right