Hi,
I am using reactive web. I have used input widget with number type, I have to set the maximum length 5, but maximum length property is not available for number type it is only available for text type.
Hello Shrinjala,
I did various tests on this matter and I believe that I've found a solution for you :)
On the OnReady event of your screen, you can create an Event Listener for your Input Element using JavaScript.
document.getElementById("Input_Number").addEventListener("input", function() { Input_Number.value = Input_Number.value.slice(0, 5); });
Basically, I'm using input event to control the allowed maximum length for that element using slice function. This will allow you to maintain your Input Type defined as Number.
Please refer to attached OML file.
Hope that this helps you!
Kind regards,
Rui Barradas
Hi Rui,
This Script working very well.
I just adapt to affect all fields in screen.
If someone needs:
Many thanks mate
Hi Paulo,
You are replying to and discussion of about 20.months ago and that already has a reply marked as solution.
Yes, I know. Thank you for the reminder ;)
That is correct you have to validate the entered value yourself. So let's say max length 5 then you can check in value <= 99999. Alternatively you could also validate the input using regular expression.
Regards,
Daniel
Yes for "Number" type input field there is no provision to set the maximum length of the valus.
You can solve this problem using below steps:
- Use a action in "OnChanges" of the input field .
-Inside the action use "Regex Search" as shown in snap shot below
-Assign the value of "Regex Pattern" to the variable which is bind with you input field
Hope this will help you
Vipasha
Vipasha Sharma wrote:
its not working. I can use text type input but then i have to prevent the user to enter character, Please suggest solution.
Hi Shrinjala,
You can try the following proposed solution with the use of some Javascript that runs on the onKeyDown event of the Input field.
Nordin
Nordin Ahdi wrote:
I have tried this but its not working for me.
can you share oml with us so can find whats the problem in your case if this solution is not working.
Regards
Rahul
@Daniël Kuhlmann ,
@Rui Barradas,
I deploy your solution in my flow but I have this error .
This mean you are running the script before your field loaded in DOM
I put the JS Code in the On Ready Action
Send your oml
Thank you for your interest
I solve the problem
Why are we restarting a discussion more than 1,5 year old?
Because I have the same problem !!!!
Don't think so because for the original poster a reply was the solution, apparently not for you.
Better to create a new discussion, and link to this old discussion.
Ok .
document.getElementById("Input_Number").addEventListener("input", function() { Input_Number.value = Input_Number.value.slice(0, $parameters.MaxLength);});
I would like to bring to your attention an issue encountered during the form submission process. We have implemented a JavaScript snippet using onready to assign and manipulate a value from an input box. However, it appears that the value set in the variable is not being recognized or submitted with the form.
Despite assigning the value from the input field using JavaScript, the backend is not receiving the updated value upon form submission. This is affecting the proper capture of user input data.
Kindly review the script implementation and advise on any necessary changes to ensure that the dynamically assigned value is correctly submitted.