I Have a input widget with input type number but when i enter normal value like 1,2,3 etc. and increase its value
with increase decrease icon in input widget it give +1 value but when i enter decimal value it also give +1 value
So, What should i do that when i enter normal number like123 it give +1 value ,
and when i enter decimal value like 1.2,1.5 it give +.1 value
Hi Ashraf,
You can do this using the parameter "step"
<input type="number" id="quantity" name="quantity" step="0.1">
You can change this attribute in extended properties of the input
Result:
Regards
Its working but it only increasing 0.1 value
But i want that when i add number only like 1,5, 8 etc. it add +1 to it But
when i add decimal value like 1.5, 1.6, 2.5 etc. it add +0.1,
now its only adding +0.1 in all values
You can use JS events to change the value of step in runtime.
Something like that:
<input type="number" id="quantity" name="quantity" min="1" max="5" onchange="myFunction()">
<script>
function myFunction() {
var number = document.getElementById("quantity").value;
if (INTEGER) {
document.getElementById("quantity").setAttribute('step', '1')
} else {
document.getElementById("quantity").setAttribute('step', '0.1')
}
</script>
if your application is of the reactive type, it's a little simpler.
You can use an event associated with the input invoking a screen action, perform the validation if it is integer or decimal, and use JavaScript to change the value of the STEP attribute of the input you want.
Sir Can You Please Send me the OML file
Hi Mohd,
If you have any questions, don't hesitate to ask.
if it works, remember to close the post by marking some post as a solution.