Recently, I was working on creating several cascading dropdowns on a Gravity Form. Everything was working great on the front-end as I was loading my custom js file in my custom plugin using the following actions.
add_action( ‘gform_enqueue_scripts_’.FORM_ID, ‘your_function_name’, 10, 2 );
add_action( ‘admin_enqueue_scripts’, ‘load_custom_wp_admin_style’ );
The second action is to load this script onto WordPress admin screens and to my horror it didn’t work when I tried to edit an entry using the Gravity Forms edit entry screen. It took me a while to find this little gem in Gravity Forms documentation.
add_filter( 'gform_noconflict_scripts', 'register_script' );
This filter will make sure your custom scripts are loaded even with the ‘noconflict’ mode set to “ON” in Gravity Forms settings. It’s also a good idea to check that you’re only loading your custom script on the Gravity Forms page by using something like this in your function.
if ( RGForms::is_gravity_page() ) {
//enqueing my script on gravity form pages
//Enqueue your scripts here using wp_enqueue_scripts
}
Hope this helps you as much as it did me when I ran into this issue.