If a mask edit position is optional, why is the user required to enter it before moving onto the next valid position?
Example1:
<igtxt:WebMaskEdit ID="WebMaskEdit1" runat="server" InputMask="?0" />
Example 2:
<igtxt:WebMaskEdit ID="WebMaskEdit2" runat="server" InputMask="99.99" />
The ajax control toolkit works properly with thier mask edit http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/MaskedEdit/MaskedEdit.aspx
Is there any property that changes the way this works?
Hello Chad,
Take a look at the answer given to this forum thread:
http://forums.infragistics.com/forums/p/21130/76114.aspx
The answer given there, answers your question with the optional mask-flags.
Regards,
Lyuba Petrova
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks for the suggestion, i had seen that post before i created this topic but unfortunately does not help me since i cannot easily convert every mask edit in my system to a text edit.
Guess i was looking for the easy way out, and therefore came up with my own solution to make the mask realize that it was using a numeric input and handle the decimal input which works in the scenarios i mentioned above for me.. Im sure this solution is not perfect, but is working with my mask settings:
<igtxt:WebMaskEdit ID="mask2" runat="server" InputMask="99.###" PadChar="0" PromptChar="0" EmptyPositionChar="0" DisplayMode="Mask" DataMode="AllText" HorizontalAlign="Right"> <ClientSideEvents KeyPress="maskDecimalInput_KeyPress" /> </igtxt:WebMaskEdit>
// Event which is fired before mask gets character from browser (key). function maskDecimalInput_KeyPress(oMask, keyCode, oEvent) { if (keyCode == 46) //"." { var mask = oMask.getInputMask(); var inputValue = oMask.getValue(); var decimalPosition = mask.indexOf("."); var beginSelection = oMask.getSelection(true); var endSelection = oMask.getSelection(false); var selectedText = oMask.getSelectedText(); var emptyChar = oMask.emptyChar; // Should be "0" if (selectedText.length == 0 && beginSelection < decimalPosition) //Need to do this to support entering "1." or else the display reverts back to "10." { var valueBeforeDecimal = inputValue.substring(0, beginSelection); var emptyMask = mask.replace(/[^\.]/gi, emptyChar); var newValue = emptyMask.substring(0, decimalPosition - beginSelection) + valueBeforeDecimal + emptyMask.substring(decimalPosition); oMask.setValue(newValue); } else if (selectedText.length > 0) { if (selectedText.length == mask.length) //Entire String is highlighted { var newValue = mask.replace(/[^\.]/gi, emptyChar); oMask.setValue(newValue); } else if (selectedText.length != mask.length) //Partial string is highlighted { var newValue = inputValue.substring(0, beginSelection) + selectedText.replace(/[^\.]/gi, emptyChar) + inputValue.substring(endSelection); oMask.setValue(newValue); } } oMask.select(decimalPosition + 1); } }