Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gravity-forms/gw-quantity-as-decimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function init() {
add_filter( 'gform_field_input', array( $this, 'modify_quantity_input_tag' ), 10, 5 );
}

add_filter( 'gform_field_content', array( $this, 'fix_content' ), 10, 5 );
}

function allow_quantity_float( $result, $value, $form, $field ) {
Expand Down Expand Up @@ -87,6 +88,11 @@ function modify_quantity_input_tag( $markup, $field, $value, $lead_id, $form_id
return $markup;
}

function fix_content( $content, $field, $value, $lead_id, $form_id ) {
// ensure the quantity min attribute.
return preg_replace( '/\smin=["\']0["\']/', 'min="0" step="any"', $content );
}

function get_field_input( $field, $value, $form ) {

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