Thank you dear Rob.. Actually i have already take a look on the knowledgebase.. The issues i have with this code are:
1) I need to check my SKU field to match the products when updating from form A to Form B... But in the example it's checking the user id instead of product SKU..
2) In this example it addresses two specific fields to get data from form A and write data to form B. Since i have several repeaters in form A how can i address each repeater sections SKU field and stock quantity fileds?
SAMPLE CODE
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 == 113){//Change 113 to the ID of the first form
global $wpdb;
$first_field = $_POST['item_meta'][25]; //change 25 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='112' and user_id=". $user);//Change 112 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' => '6422'));//Change 6422 to the ID of the field to be updated automatically in your second form
}
}
The sample code is meant as a starting point. You can put whatever code you want in the hooks. From the sound of it, you're not well-versed in customizing PHP code. I suggest you reach out to a developer for help. Otherwise, you can look at all the PHP examples and use trial and error to find out what you need. The one hint I'll offer is that repeater sections are their own "embedded" forms whose entries are linked back to the main form's entry. You can reach developers here - https://formidable-masterminds.com/developers-directory/
Please login or Register to submit your answer