How can i restrict the product quantity field to numbers only in Gravity Forms.
And how can we add some increment arrow to the quantity field?
like on this demo ? http://demos.gravitywiz.com/gp-conditional-pricing/
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The increment arrows are inherent in <input type="number">, your browser automatically adds them.
When you’re setting up your form you just use the ‘number’ input rather than a ‘text’ input.
So instead of <input type="text" id="field_id" name="field_name" value="" />, what you want to use is something akin to:
<input type="number" id="field_id" name="field_name" value="" step="1"/>
You can see the various attributes that can be set/specified for number inputs here:
https://www.w3schools.com/tags/att_input_type_number.asp
Method 2
Thanks to David from Gravity Wiz.
He gave me the hint that i just need to enabled HTML5 on the Gravity Forms global settings page.
Can’t believe i missed that setting.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0