Skip to content

Commit 0d1c480

Browse files
committed
gw-quantity-as-decimal.php: Fixed an issue with Calculation Product field not editable with decimal values.
1 parent 50d3fac commit 0d1c480

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gravity-forms/gw-quantity-as-decimal.php

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function init() {
4848
add_filter( 'gform_field_input', array( $this, 'modify_quantity_input_tag' ), 10, 5 );
4949
}
5050

51+
add_filter( 'gform_field_content', array( $this, 'fix_content' ), 10, 5 );
5152
}
5253

5354
function allow_quantity_float( $result, $value, $form, $field ) {
@@ -87,6 +88,11 @@ function modify_quantity_input_tag( $markup, $field, $value, $lead_id, $form_id
8788
return $markup;
8889
}
8990

91+
function fix_content( $content, $field, $value, $lead_id, $form_id ) {
92+
// ensure the quantity min attribute.
93+
return preg_replace( '/\smin=["\']0["\']/', 'min="0" step="any"', $content );
94+
}
95+
9096
function get_field_input( $field, $value, $form ) {
9197

9298
remove_filter( 'gform_field_input', array( $this, 'modify_quantity_input_tag' ), 10, 5 );

0 commit comments

Comments
 (0)