Disable animated transitions for specific fields

I’m trying to disable animated transitions for a two specific conditional logic fields in one of my forms. I would like the transitions to continue working for the rest of the form. I found this snippet linked below and have tried to edit it to serve this purpose, but can’t seem to get it to work. Everything I’ve tried seems to disable conditional logic altogether, either for one field or the entire form. I would appreciate any advice!

This was my attempt, but I really don’t know what I’m doing. :smile:

gform.addFilter( 'gform_abort_conditional_logic_do_action', function( abort, action, targetId, useAnimation, defaultValues, isInit, formId, callback ) {
 
    if ( formId == 36 && targetId == '#field_36_32' ) {
        useAnimation = false;
    }
    return useAnimation;
 
} );

The animated transitions setting is not configurable per field and there isn’t a filter for it on the front-end. It can be filtered server-side ($form['enableAnimation'] = false;) via the gform_pre_render filter, which runs before the form markup is generated.

Thank you! This is what I tried. It disables transitions while allowing conditional logic to keep working, but it affects the whole form and not just the one field. What am I missing?

add_filter( 'gform_pre_render_36', 'disable_transition' );
function disable_transition( $form ) {
 
    //Set conditional logic only for form 14
    if ( rgar( $form, 'id' ) !== 36 ) {
        return $form;
    }
 
    foreach ( $form['fields'] as &$field ) {
        if ( $field->id == 32 ) {
            $form['enableAnimation'] = false;
        }
    }
    return $form;
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.