This is a migrated thread and some comments may be shown as answers.

Numeric password

1 Answer 57 Views
Input
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 27 May 2010, 09:28 PM
Helloo!

Is there any way to create a textbox for numeric password?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 May 2010, 08:23 AM
Hi,

If you want to accept numbers only in a password textbox, then you could try the following approach.

aspx:
 
    <telerik:RadTextBox ID="RadTextBox1" runat="server" TextMode="Password">  
        <ClientEvents OnKeyPress="OnKeyPress" /> 
    </telerik:RadTextBox> 

client code:
 
<script type="text/javascript">  
    function OnKeyPress(sender, eventArgs) {  
        var re = /^[0-9]$/;  
        var v = re.test(eventArgs.get_keyCharacter());  
        eventArgs.set_cancel(!v);  
    }  
</script> 


hope this going to help :)
Princy.
Tags
Input
Asked by
Daniel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or