• Resolved creatable

    (@creatable)


    While syncing my forms to Hubspot, I came across a problem.

    I have two Phone number fields (phone1, phone2), where only one will be filled in based on a conditional rule of another field.

    Example:

    Phone1 field displays if Country select field “USA” is selected.
    Phone2 field displays if Country select field “CANADA” is selected.

    When mapping these fields to Hubspot, I would like to map these to the Hubspot Phone number field. Only one of the two Forminator fields should map, but I don’t see a way to map both Phone1 and Phone2 to the same Hubspot field.

    I tried creating two field mapping rules:

    (Hubspot) Phone -> (Forminator) Phone1
    (Hubspot) Phone -> (Forminator) Phone 2

    But when saving , it deletes one, likely because there is two attempts to map to the same Hubspot field.

    Is there any solution or workaround for this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Laura – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @creatable

    Hope this message finds you well.

    This is not currently possible. Still, I share this with our developer to check if they can provide a workaround or not. Since they work on very complex issues, getting a reply from them could take longer than expected.

    We will update this topic once we get an update from them.

    Best regards,
    Laura

    Plugin Support Laura – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @creatable

    We got feedback from our devs.

    This will require a third Phone field which will get any of the other Phone fields when filled. This is the one you need to map to Hubspot.

    Then use this snippet:

    add_action( 'wp_footer', 'wpmudev_phone_hubspot_fix', 9999 );
    function wpmudev_phone_hubspot_fix() {
    	global $post;
    	if ( is_a( $post, 'WP_Post' ) && ! has_shortcode( $post->post_content, 'forminator_form' ) ) {
    		return;
    	}
    	?>
    	<script type="text/javascript">
    	jQuery(document).ready(function($) {
    		setTimeout(function() {
    			$('.forminator-custom-form').trigger('after.load.forminator');
    		}, 500);
    		
    		$(document).on('after.load.forminator', function(event, form_id) {
    			if ( event.target.id === 'forminator-module-2960' ) { // Please change 2960 to your form's ID.
    				$('#phone-1 input').on('input',function(){
    					$('#phone-3 input').val( $(this).val() );
    				});
    				
    				$('#phone-2 input').on('input',function(){
    					$('#phone-3 input').val( $(this).val() );
    				});
    			}
    		});
    	});
    	</script>
    	<?php
    }

    It requires you to update these lines:

    Replace 2960 with your form ID

    if ( event.target.id === 'forminator-module-2960' ) { // Please change 2960 to your form's ID.

    Replace -1 and -2 with your Phone fields:

    $('#phone-1 input').on('input',function(){
    $('#phone-2 input').on('input',function(){

    Replace -3 with your 3rd Phone field too

    $('#phone-3 input').val( $(this).val() );

    You might need to install it as a mu-plugin following the instructions on this link https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins.

    Lastly hide the 3rd Phone field using forminator-hidden class, in the Styiling tab.

    Let us know the results.

    Best regards,
    Laura

    Thread Starter creatable

    (@creatable)

    Hi, I got this to work. Thank you for the quick response and technical help!

    Not ideal to have to rely on Javascript for this, but it will work for now.

    As a long term user of Forminator, this is a feature that I think would have major implications.

    We can already do this with any of the calculation fields, but it would be of great value if we could have logic fields for the text-based fields.

    Or a simple function that will allow you to do a hidden text field, and have it equal the contents of another textfield box.

    Thanks again.

    Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @creatable,

    We are glad to hear that the issue has been resolved and we will mark this thread accordingly. If you have any additional questions or require further help, please let us know!

    Kind regards,
    Zafer

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.