Skip to content

Commit 0394642

Browse files
authored
gw-disable-submit-button-until-required-fields-are-filled-out.php: Fixed a compatibility issue with GP Populate Anything.
1 parent 16c15eb commit 0394642

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gravity-forms/gw-disable-submit-button-until-required-fields-are-filled-out.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ public function maybe_output_script( $form ) {
3232
}
3333

3434
if ( ! self::$script_output ) {
35-
$this->script();
35+
add_action( 'wp_footer', array( $this, 'output_script' ) );
36+
add_action( 'gform_preview_footer', array( $this, 'output_script' ) );
3637
self::$script_output = true;
3738
}
3839

3940
return $form;
4041
}
4142

42-
public function script() {
43+
public function output_script() {
4344
?>
4445

4546
<script type="text/javascript">
@@ -83,6 +84,15 @@ public function script() {
8384
self.runCheck();
8485
});
8586

87+
// Check when fields are repopulated because of GPPA
88+
$(document).on( 'gppa_updated_batch_fields', function() {
89+
self.runCheck();
90+
});
91+
// GPPA logic may enable submit button, disable that logic.
92+
gform.addFilter( 'gppa_disable_form_navigation_toggling', function() {
93+
return true;
94+
});
95+
8696
self.runCheck();
8797

8898
}

0 commit comments

Comments
 (0)