Skip to content

Commit 1024927

Browse files
authored
gw-gravity-forms-rounding.php: Fixed an issue with rounding now updating form total.
1 parent 6a4c678 commit 1024927

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gravity-forms/gw-gravity-forms-rounding.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ function output_script() {
189189
var value = self.getRoundedValue( $input );
190190
if( $input.val() != value ) {
191191
$input.val( value ).change();
192+
const input = $input[0];
193+
// Ensure Gravity Forms detects the programmatic value change by dispatching a native input event
194+
input.dispatchEvent( new Event( 'input', { bubbles: true } ) );
192195
}
193196
};
194197

@@ -216,7 +219,7 @@ function output_script() {
216219

217220
}
218221

219-
if( value != '' ) {
222+
if( value !== '' ) {
220223
for( var i = 0; i < actions.length; i++ ) {
221224
value = GWRounding.round( value, actions[i].actionValue, actions[i].action );
222225
}

0 commit comments

Comments
 (0)