KO GF Field Lock
Lock Gravity Forms radio fields so selecting one field disables and fades another.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/wy4tt34rp/ko-gf-field-lock/archive/refs/heads/main.zipOverview
Locks mutually exclusive Gravity Forms radio fields. When a user selects an option in one configured field, the paired field is disabled and faded. Clicking the selected radio option again clears it and unlocks the paired field.
Key Features
- Targets Gravity Form ID
2 - Locks Field
63when Field115has a selection - Locks Field
115when Field63has a selection - Supports click-again radio deselection for configured fields
- Reinitializes after Gravity Forms AJAX renders, AJAX page changes, validation refreshes, and conditional-logic updates
- Adds
aria-disabled="true"and the.ko-locked-fieldclass while a field is locked
Requirements
- WordPress
- Gravity Forms
Installation
- Copy the
ko-gf-field-lockplugin folder into/wp-content/plugins/ - Activate it from the WordPress admin
- Test Form ID
2in a staging environment before production rollout
Usage
The current configuration is code-based and intentionally narrow:
array( 63, 115 ),
array( 115, 63 ),
Each pair is one-way. The two entries above create the current two-way mutual exclusion behavior.
Configuration
Additional field pairs can be added in code or by filtering ko_gf_field_lock_field_pairs:
add_filter( 'ko_gf_field_lock_field_pairs', function ( $pairs, $form_id ) {
if ( 2 !== (int) $form_id ) {
return $pairs;
}
$pairs[] = array( 80, 114 );
$pairs[] = array( 114, 80 );
return $pairs;
}, 10, 2 );
Extensibility
Future enhancements could add an admin settings screen, reusable lock groups, visual lock messages, explicit clear links, or import/export of configuration.
Development Notes
- JavaScript is loaded with the plugin's own
ko-gf-field-lockhandle instead of attaching inline code to a Gravity Forms internal script handle. - Lifecycle handling listens for
gform/post_render, legacygform_post_render,gform_page_loaded, andgform/conditionalLogic/applyRules/end. - Disabled radio inputs are only re-enabled when this plugin disabled them.
License
GPL-2.0-or-later