I need to define a alpha only edit mask for a field with a length of 30 characters. Is there a simple method of npot having to type out 30 question marks?
Thanks for any suggestions!
Hi,
If you need entry without prompts, then you should use WebTextEdit. Idea behind WebMaskEdit is provide strict length of entry.
It is very easy to filter entry. Example of editor which has max length of 30 and allows only A-Z and a-z entries:
<script type="text/javascript">function WebTextEdit1_KeyPress(oEdit, keyCode, oEvent){ //------------------ // cancel all characters which are smaller than A and larger than z // A==65, z==122 if(keyCode < 65 || keyCode > 122) oEvent.cancel = true; //------------------ // cancel all characters which are between Z and a // Z==90, a==97 if(keyCode > 90 && keyCode < 97) oEvent.cancel = true;}</script><igtxt:WebTextEdit ID="WebTextEdit1" runat="server" MaxLength="30"> <ClientSideEvents KeyPress="WebTextEdit1_KeyPress" /></igtxt:WebTextEdit>
Thanks for the suggestion!
I am actually using WebTextEdit, but this is probably similar.How can I return an upper case value to the text box if they pressed a lower case value when using keypress?This still displays the lower case, even though I don't cancel the key press.
{
oEvent.keyCode = keyCode - 32;
//oEvent.cancel=false;
}
I figured it out.
keyCode = keyCode - 32;
oEvent.keyCode = keyCode
Actually, that should be:
if (keyCode >= 97 && keyCode <= 122)