how to set the lenth and max value dynamically to the inputfield?

In the web application, we have a list of inputs I want to set the max.length  and want to restrict the user to enter the "allowUserToEnterTill" value of each input by getting  API response dynamically. the API response is as shown below.

response:[

{

maxLength:4,

allowUserToEnterTill:9000

}

{

maxLength:2,

allowUserToEnterTill:95

}

]

as of now, we are not able to set the dynamical length to max.length property of an input field.
is there any possible solution to overcome this problem.

Hi,


You can use JS code to restrict max length dynamically of the text input field.


Thanks.

Solution

Hi Santhu,

 you have another  option to set maxlenght property like below image and you can bind varible here.


Based on you requirement you can create a common action and validate values.


regards

Rahul Sahu

Solution

Yes, Agree with Rahul answer..Thanks!

Hi Rahul Sahu  


thank you for the solution max length extended property working fine.. but without creating an action can we restrict the user to enter until  "allowUserToEnterTill" value.

Thanks 

Santhu

santhu MS wrote:

Hi Rahul Sahu  


thank you for the solution max length extended property working fine.. but without creating an action can we restrict the user to enter until  "allowUserToEnterTill" value.

Thanks 

Santhu

Hi Santhu,

I think no this kind of property not present, you need to create an action and use javascript action on keypress event for that.


Regards

Rahul Sahu


Thank you Rahul Sahu .