I have problems adding required and step attributes in Custom Form 7 number fields. I have tried using two different methods in the same form and have two different problems
I am trying to add a required number field and a step size of 0.05.
1) [number* number-491 id:abc min:0 max:100000 step:0.05 placeholder “CMP*”]
– This honors the step size attribute but NOT the step:0.05
2) <input type=”number” name=“CMP” placeholder=“CMP*” min=0 max=100000 step=“0.05” required/>
– This honors the step size attribute but not the required attribute.
I am OK with using either or an alternate method, all I want is a number field that will be a required field and a step size of 0.05.
You can achieve this via customization. Use following code in your theme's or child-theme's functions.php file.
What above code does is, ads a custom form tag "numberstepfloat" which actually outputs input type number but includes the step attribute. Another function in the code ads validation for the custom tag. Validation only checks if the value is present. If not invalidates the field.
Similar to native tags in Contact Form 7, the custom tag is to be used as follows.
Hope this helps.