Pergunta

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/

Foi útil?

Solução 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.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top