Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor genetech

    (@genetech)

    Hi,

    If you want to copy the dropdown value to save it in a hidden field, then use that hidden field value as text in a different form, use the below code:

    
    // This action fires when user is created with Pie Register registration form.
    add_action('pie_register_after_user_created', 'pie_dropdown_val_to_field')	;
    
    function pie_dropdown_val_to_field($user){
       
       // $user is an object of the user registered with the registration form.
       if(is_object($user) && $user->ID != 0){
    
    		// Get the registered user's id
    		$_user_id = $user->ID;
    
    		// Retrieving the value of the dropdown
    		$user_data    = get_user_meta($_user_id, 'pie_dropdown_6');
    
    		// If the value exists
    		if(!empty($user_data)){
    			
    			// Get value as a text and update in hidden field i.e. hidden_3
    			$dropdown_value = $user_data[0][0];
    			update_user_meta($_user_id, 'pie_hidden_3', $dropdown_value);
    		}
    	}
    }
    

    Hope it helps.

    Thank you

    Plugin Contributor genetech

    (@genetech)

    Hi,

    We haven’t heard back from you in a while, so we are going to mark this as resolved. Feel free to start a new thread if you have any further questions!

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to copy a dropdown field to another field.’ is closed to new replies.