404
Views
11
Comments
Input type password data type number
Question

Hi all,


I have an input widget as password, and my requirement is to restrict it to only numbers, i am assigning a text variable to it it allows, but when i assign number variable to it, it gives me error.

Does anyone knows how to achieve this?


Thanks in advance :)

Dhiraj M

UserImage.jpg
vikas sharma
Champion

Hi Dhiraj,

You line ", i am assigning a text variable to it it allows, but when i assign number variable to it," is confusing. Please help to explain it.

Although if want to make password field to accept numbers only, then set data type to integer/number for this input field.


Thanks.

2019-10-04 15-01-22
Dhiraj Manwani

Vikas Sharma wrote:

Hi Dhiraj,

You line ", i am assigning a text variable to it it allows, but when i assign number variable to it," is confusing. Please help to explain it.

Although if want to make password field to accept numbers only, then set data type to integer/number for this input field.


Thanks.

I need to set password variable as integer and Input type as password.

Hope you got the requirement.

Activation code as integer.

2020-01-29 14-47-45
Filipe da Silva

Dhiraj Manwani wrote:

Vikas Sharma wrote:

Hi Dhiraj,

You line ", i am assigning a text variable to it it allows, but when i assign number variable to it," is confusing. Please help to explain it.

Although if want to make password field to accept numbers only, then set data type to integer/number for this input field.


Thanks.

I need to set password variable as integer and Input type as password.

Hope you got the requirement.

Activation code as integer.

I think you can't use a Password Input Type with an Integer variable right? it gives you an error?

Input type Password allows letters, the Numbers input type restricts inputs to numbers and a few special chars like ' - ', ' * ' and a few others.


2020-01-29 14-47-45
Filipe da Silva

Set the Input Type to number and the password variable to integer.

You can also use the OnChange event to do extra processing.

Hope it helps!

2019-10-04 15-01-22
Dhiraj Manwani

Filipe Silva wrote:

Set the Input Type to number and the password variable to integer.

You can also use the OnChange event to do extra processing.

Hope it helps!


This won't be a password input type.

I need to set password variable as integer and Input type as password.

Hope you got the requirement.

2021-08-12 11-00-27
Nordin Ahdi
 
MVP

Hi Dhiraj,

You could also use a Number Mask for this. Have a look at this Forge component.

Regards,

Nordin

2018-10-04 11-30-51
glenn michiels

Hi Dhiraj Manwani,

To fulfill your requirements you could use the following settings:

Input type: password

Text variable Activationcode

Now to validate if the input exists of only numbers you can apply this validation in a client action which is used to handle the on change event. 

In this action you could use regex expressions to verify if the input exists of a number or not. 


Hope this helps.

Glenn

2019-10-04 15-01-22
Dhiraj Manwani

glenn michiels wrote:

Hi Dhiraj Manwani,

To fulfill your requirements you could use the following settings:

Input type: password

Text variable Activationcode

Now to validate if the input exists of only numbers you can apply this validation in a client action which is used to handle the on change event. 

In this action you could use regex expressions to verify if the input exists of a number or not. 


Hope this helps.

Glenn

Hi Gleen,
I got you, i can do it with regex, but is there any way that if the user enters alphabets or special characters in that text box, they are not taken as input in the textbox.

in short i mean to say in can't i restrict user entering alphabets, if he tries to enter alphabet, cursor stays there itself and no alphabet is taken as input.



Thanks,

DM.


2018-10-04 11-30-51
glenn michiels

Dhiraj Manwani wrote:

glenn michiels wrote:

Hi Dhiraj Manwani,

To fulfill your requirements you could use the following settings:

Input type: password

Text variable Activationcode

Now to validate if the input exists of only numbers you can apply this validation in a client action which is used to handle the on change event. 

In this action you could use regex expressions to verify if the input exists of a number or not. 


Hope this helps.

Glenn

Hi Gleen,
I got you, i can do it with regex, but is there any way that if the user enters alphabets or special characters in that text box, they are not taken as input in the textbox.

in short i mean to say in can't i restrict user entering alphabets, if he tries to enter alphabet, cursor stays there itself and no alphabet is taken as input.



Thanks,

DM.


Hi Dhiraj Manwani,

In that case you can use the regexReplace action in the OnChange action to only save digits in your variable.

Assign the result of the replace action to the same variable and it'll filter out any non-digit character.


Regards,

Glenn


2025-07-22 10-24-12
Lakshmi Kumar Yadav

Hi Dhiraj,

By Using Password widget, it changes the "type" of input to "password", hence it will accept all the character.

You can try to use below code to take integer password from user .

add a "onkeypress" event on extended property with below value.

"return event.charCode === 0 || /\d/.test(String.fromCharCode(event.charCode));"


Hope this helps you!!

Regard's

Lakshmi Kumar


UserImage.jpg
Gonçalo Oliveira

Hello,


You can do it with regex, but there are alot of masks in the forge that can help you.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.