Skip Navigation

[Resolved] How to see when someone clicks the types-related-content-actions buttons

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1078640
Screen Shot 2018-08-09 at 3.04.24 PM.png

Tell us what you are trying to do?

I'm using the excellent information here to extract geocode data into individual fields:
https://toolset.com/forums/topic/separating-content-from-the-address-field/
It's working great. EXCEPT
I have a child post type that I also need to insert data into. It looks like the function is not firing when that child type modal form is opening up in the parent.
Is there a way to "listen" for the click on those buttons?

Is there any documentation that you are following?
https://toolset.com/forums/topic/separating-content-from-the-address-field/

What is the link to your site?

hidden link

#1078709

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Christopher,

Thank you for contacting our support forum.

What you can do is to add a click listener.

Try this

( function( $ ) {
 
    $( 'input[type="button"][value="My task"]' ).click( function(){
 
        $("input.js-toolset-google-map").on( "geocode:result", function( event, result ){
 
            var addressComponents = result.address_components,
                postal_code = "";
 
            $.each( addressComponents, function( index, value ){
 
                if ( addressComponents[ index ].types[0] == "postal_code" ) {
                    postal_code = addressComponents[ index ].short_name;
                }
 
            } );
 
            $('input[name="wpcf[postcode]"]').val( postal_code );
        } );
 
    } );
 
})( jQuery );

Now you will replace the value of My Task with the value of the Add New button on the backend.

Please try this and let me know if this helps.
Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.