RE: Input Text Mask?
johan, see https://issues.apache.org/jira/browse/WICKET-1085 -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Saturday, October 20, 2007 12:55 PM To: users@wicket.apache.org Subject: Re: Input Text Mask? I think such a thing in extentions would also be nice. johan On 10/18/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > would you be interested in making this a subclass of textfield and > throwing it into wicketstuff-minis project which is in wicket-stuff? > > -igor > > > On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > > Is anyone interested in using the mask script (below) to a component in > a Wicket extension? The script prevents invalid input in a text field as the > user types (similar to the Atlas version: > http://www.fci.com.br/maskedit/MaskEdit/MaskEdit.aspx). I didn't see a > component in Wicket that would accomplish this out-of-the-box and thought it > would be a cool addition to Wicket. > > > > For example to force the input to mask a phone number: > > > > > > /** > > * InputTextMask script used for mask/regexp operations. > > * Mask Individual Character Usage: > > * 9 - designates only numeric values > > * L - designates only uppercase letter values > > * l - designates only lowercase letter values > > * A - designates only alphanumeric values > > * X - denotes that a custom client script regular expression is > specified > > * All other characters are assumed to be "special" characters used to > mask > > * the input component > > * Example 1: > > * (999)999- only numeric values can be > entered where the the character > > * position value is 9. Parenthesis and dash are non-editable/mask > characters. > > * Example 2: > > * 99L-ll-X[^A-C]X only numeric values for the first two characters, > > * uppercase values for the third character, lowercase letters for the > > * fifth/sixth characters, and the last character X[^A-C]X together > counts > > * as the eighth character regular expression that would allow all > characters > > * but "A", "B", and "C". Dashes outside the regular expression are > > * non-editable/mask characters. > > */ > > var InputTextMask = { > > processMaskFocus: function(input, mask, clearWhenInvalid){ > > // create an input mask and register it on the specified > input (if it hasnt already been added by a previous call > > InputTextMask.createInputMask(input, mask, > clearWhenInvalid); > > if(input.value.length == 0){ > > // when the input value is empty populate it > with the viewing mask and move the cursor to the > > // beginning of the input field > > var cursorPos = > > InputTextMask.getCursorPosition(input, > input.value); > > input.value = input.mask.viewMask; > > InputTextMask.moveCursorToPosition(input, null, > cursorPos); > > } > > }, > > getEvent: function(e) { > > // get the event either from the window or from the > passed event > > return (typeof event != 'undefined')? event: e; > > }, > > handleEventBubble: function(keyEvent, keyCode){ > > // this method ensures that the key enterned by the user > is not propagated unless it is a tab or arrow key > > try { > > if(keyCode && (keyCode.isTab || > keyCode.isLeftOrRightArrow)){ > > // allow all tab/arrow keys by returning > true- no further action required > > return true; > > } > > keyEvent.cancelBubble = true; > > if(keyEvent.stopPropagation){ > > // prevent other event triggers > > keyEvent.stopPropagation(); > > } > > if(keyEvent.preventDefault){ > > // prevent the default event from > firing. in this case it is propagation of the keyed input > > keyEvent.preventDefault(); > > } > > return false; > > } catch(e) { > > alert(e.message); > > } > > }, > >
Re: Input Text Mask?
I think such a thing in extentions would also be nice. johan On 10/18/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > would you be interested in making this a subclass of textfield and > throwing it into wicketstuff-minis project which is in wicket-stuff? > > -igor > > > On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > > Is anyone interested in using the mask script (below) to a component in > a Wicket extension? The script prevents invalid input in a text field as the > user types (similar to the Atlas version: > http://www.fci.com.br/maskedit/MaskEdit/MaskEdit.aspx). I didn't see a > component in Wicket that would accomplish this out-of-the-box and thought it > would be a cool addition to Wicket. > > > > For example to force the input to mask a phone number: > > > > > > /** > > * InputTextMask script used for mask/regexp operations. > > * Mask Individual Character Usage: > > * 9 - designates only numeric values > > * L - designates only uppercase letter values > > * l - designates only lowercase letter values > > * A - designates only alphanumeric values > > * X - denotes that a custom client script regular expression is > specified > > * All other characters are assumed to be "special" characters used to > mask > > * the input component > > * Example 1: > > * (999)999- only numeric values can be > entered where the the character > > * position value is 9. Parenthesis and dash are non-editable/mask > characters. > > * Example 2: > > * 99L-ll-X[^A-C]X only numeric values for the first two characters, > > * uppercase values for the third character, lowercase letters for the > > * fifth/sixth characters, and the last character X[^A-C]X together > counts > > * as the eighth character regular expression that would allow all > characters > > * but "A", "B", and "C". Dashes outside the regular expression are > > * non-editable/mask characters. > > */ > > var InputTextMask = { > > processMaskFocus: function(input, mask, clearWhenInvalid){ > > // create an input mask and register it on the specified > input (if it hasnt already been added by a previous call > > InputTextMask.createInputMask(input, mask, > clearWhenInvalid); > > if(input.value.length == 0){ > > // when the input value is empty populate it > with the viewing mask and move the cursor to the > > // beginning of the input field > > var cursorPos = > > InputTextMask.getCursorPosition(input, > input.value); > > input.value = input.mask.viewMask; > > InputTextMask.moveCursorToPosition(input, null, > cursorPos); > > } > > }, > > getEvent: function(e) { > > // get the event either from the window or from the > passed event > > return (typeof event != 'undefined')? event: e; > > }, > > handleEventBubble: function(keyEvent, keyCode){ > > // this method ensures that the key enterned by the user > is not propagated unless it is a tab or arrow key > > try { > > if(keyCode && (keyCode.isTab || > keyCode.isLeftOrRightArrow)){ > > // allow all tab/arrow keys by returning > true- no further action required > > return true; > > } > > keyEvent.cancelBubble = true; > > if(keyEvent.stopPropagation){ > > // prevent other event triggers > > keyEvent.stopPropagation(); > > } > > if(keyEvent.preventDefault){ > > // prevent the default event from > firing. in this case it is propagation of the keyed input > > keyEvent.preventDefault(); > > } > > return false; > > } catch(e) { > > alert(e.message); > > } > > }, > > createInputMask: function(input, mask, clearWhenInvalid) { > > // if this input hasnt already registered its mask go > ahead and do so now. This only needs to be performed the > > // first time the input is encountered when it gains > focus. It will attach the MaskType object to the input object > > // add add all of the appropriate event listeners to > ensure that the mask is applied > > if(!input.mask || input.mask.rawMask != mask){ > > input.mask = new InputTextMask.MaskType(input, > mask, clearWhenInvalid); > > // add the event listeners that will ensure that > when the input contains an incomplete mask it will be remove. > > // Also, make sure that the keydo
Re: Input Text Mask?
On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > Okay, sounds good... I assume I will be notified on which approach that will > be decided by the committers at some point in the process? Of course. We'll discuss in public anyway. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Input Text Mask?
Okay, sounds good... I assume I will be notified on which approach that will be decided by the committers at some point in the process? -Original Message- From: Eelco Hillenius [mailto:[EMAIL PROTECTED] Sent: Thursday, October 18, 2007 5:08 PM To: users@wicket.apache.org Subject: Re: Input Text Mask? On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > I created a Jira Issue (https://issues.apache.org/jira/browse/WICKET-1085) > with attached source. I placed the issue under extensions as others suggested. Thanks. > Would I still have to go through sf.net? It would either be put in wicket-stuff minis - in which case you can maintain it directly yourself after you get access to the wicket-stuff project - or if we want to use it for the date field components, and all comitters agree, we can put it in extensions. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Input Text Mask?
On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > I created a Jira Issue (https://issues.apache.org/jira/browse/WICKET-1085) > with attached source. I placed the issue under extensions as others suggested. Thanks. > Would I still have to go through sf.net? It would either be put in wicket-stuff minis - in which case you can maintain it directly yourself after you get access to the wicket-stuff project - or if we want to use it for the date field components, and all comitters agree, we can put it in extensions. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Input Text Mask?
I created a Jira Issue (https://issues.apache.org/jira/browse/WICKET-1085) with attached source. I placed the issue under extensions as others suggested. Would I still have to go through sf.net? -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 18, 2007 3:57 PM To: users@wicket.apache.org Subject: Re: Input Text Mask? create a sf.net account and i will give you commit access to wicketstuff repo. -igor On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > Sure. How would I go about doing so? > > -Original Message- > From: Igor Vaynberg [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 18, 2007 1:11 PM > To: users@wicket.apache.org > Subject: Re: Input Text Mask? > > > would you be interested in making this a subclass of textfield and > throwing it into wicketstuff-minis project which is in wicket-stuff? > > -igor > > > On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > > Is anyone interested in using the mask script (below) to a component in a > > Wicket extension? The script prevents invalid input in a text field as the > > user types (similar to the Atlas version: > > http://www.fci.com.br/maskedit/MaskEdit/MaskEdit.aspx). I didn't see a > > component in Wicket that would accomplish this out-of-the-box and thought > > it would be a cool addition to Wicket. > > > > For example to force the input to mask a phone number: > > > > > > /** > > * InputTextMask script used for mask/regexp operations. > > * Mask Individual Character Usage: > > * 9 - designates only numeric values > > * L - designates only uppercase letter values > > * l - designates only lowercase letter values > > * A - designates only alphanumeric values > > * X - denotes that a custom client script regular expression is > > specified > > * All other characters are assumed to be "special" characters used to mask > > * the input component > > * Example 1: > > * (999)999- only numeric values can be entered where the the character > > * position value is 9. Parenthesis and dash are non-editable/mask > > characters. > > * Example 2: > > * 99L-ll-X[^A-C]X only numeric values for the first two characters, > > * uppercase values for the third character, lowercase letters for the > > * fifth/sixth characters, and the last character X[^A-C]X together counts > > * as the eighth character regular expression that would allow all > > characters > > * but "A", "B", and "C". Dashes outside the regular expression are > > * non-editable/mask characters. > > */ > > var InputTextMask = { > > processMaskFocus: function(input, mask, clearWhenInvalid){ > > // create an input mask and register it on the specified > > input (if it hasnt already been added by a previous call > > InputTextMask.createInputMask(input, mask, > > clearWhenInvalid); > > if(input.value.length == 0){ > > // when the input value is empty populate it with > > the viewing mask and move the cursor to the > > // beginning of the input field > > var cursorPos = > > InputTextMask.getCursorPosition(input, input.value); > > input.value = input.mask.viewMask; > > InputTextMask.moveCursorToPosition(input, null, > > cursorPos); > > } > > }, > > getEvent: function(e) { > > // get the event either from the window or from the passed > > event > > return (typeof event != 'undefined')? event: e; > > }, > > handleEventBubble: function(keyEvent, keyCode){ > > // this method ensures that the key enterned by the user is > > not propagated unless it is a tab or arrow key > > try { > > if(keyCode && (keyCode.isTab || > > keyCode.isLeftOrRightArrow)){ > > // allow all tab/arrow keys by returning > > true- no further action required > > return true; > > } > > keyEvent.cancelBubble = true; > > if(keyEvent.stopPropagation){ > > // prevent other event triggers > > keyEvent.stopPropagation(); > > } > > if(keyEv
Re: Input Text Mask?
create a sf.net account and i will give you commit access to wicketstuff repo. -igor On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > Sure. How would I go about doing so? > > -Original Message- > From: Igor Vaynberg [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 18, 2007 1:11 PM > To: users@wicket.apache.org > Subject: Re: Input Text Mask? > > > would you be interested in making this a subclass of textfield and > throwing it into wicketstuff-minis project which is in wicket-stuff? > > -igor > > > On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > > Is anyone interested in using the mask script (below) to a component in a > > Wicket extension? The script prevents invalid input in a text field as the > > user types (similar to the Atlas version: > > http://www.fci.com.br/maskedit/MaskEdit/MaskEdit.aspx). I didn't see a > > component in Wicket that would accomplish this out-of-the-box and thought > > it would be a cool addition to Wicket. > > > > For example to force the input to mask a phone number: > > > > > > /** > > * InputTextMask script used for mask/regexp operations. > > * Mask Individual Character Usage: > > * 9 - designates only numeric values > > * L - designates only uppercase letter values > > * l - designates only lowercase letter values > > * A - designates only alphanumeric values > > * X - denotes that a custom client script regular expression is > > specified > > * All other characters are assumed to be "special" characters used to mask > > * the input component > > * Example 1: > > * (999)999- only numeric values can be entered where the the character > > * position value is 9. Parenthesis and dash are non-editable/mask > > characters. > > * Example 2: > > * 99L-ll-X[^A-C]X only numeric values for the first two characters, > > * uppercase values for the third character, lowercase letters for the > > * fifth/sixth characters, and the last character X[^A-C]X together counts > > * as the eighth character regular expression that would allow all > > characters > > * but "A", "B", and "C". Dashes outside the regular expression are > > * non-editable/mask characters. > > */ > > var InputTextMask = { > > processMaskFocus: function(input, mask, clearWhenInvalid){ > > // create an input mask and register it on the specified > > input (if it hasnt already been added by a previous call > > InputTextMask.createInputMask(input, mask, > > clearWhenInvalid); > > if(input.value.length == 0){ > > // when the input value is empty populate it with > > the viewing mask and move the cursor to the > > // beginning of the input field > > var cursorPos = > > InputTextMask.getCursorPosition(input, input.value); > > input.value = input.mask.viewMask; > > InputTextMask.moveCursorToPosition(input, null, > > cursorPos); > > } > > }, > > getEvent: function(e) { > > // get the event either from the window or from the passed > > event > > return (typeof event != 'undefined')? event: e; > > }, > > handleEventBubble: function(keyEvent, keyCode){ > > // this method ensures that the key enterned by the user is > > not propagated unless it is a tab or arrow key > > try { > > if(keyCode && (keyCode.isTab || > > keyCode.isLeftOrRightArrow)){ > > // allow all tab/arrow keys by returning > > true- no further action required > > return true; > > } > > keyEvent.cancelBubble = true; > > if(keyEvent.stopPropagation){ > > // prevent other event triggers > > keyEvent.stopPropagation(); > > } > > if(keyEvent.preventDefault){ > > // prevent the default event from firing. > > in this case it is propagation of the keyed input > > keyEvent.preventDefault(); > > } > > return false; > > } catch(e) { > >
RE: Input Text Mask?
Sure. How would I go about doing so? -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 18, 2007 1:11 PM To: users@wicket.apache.org Subject: Re: Input Text Mask? would you be interested in making this a subclass of textfield and throwing it into wicketstuff-minis project which is in wicket-stuff? -igor On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > Is anyone interested in using the mask script (below) to a component in a > Wicket extension? The script prevents invalid input in a text field as the > user types (similar to the Atlas version: > http://www.fci.com.br/maskedit/MaskEdit/MaskEdit.aspx). I didn't see a > component in Wicket that would accomplish this out-of-the-box and thought it > would be a cool addition to Wicket. > > For example to force the input to mask a phone number: > > > /** > * InputTextMask script used for mask/regexp operations. > * Mask Individual Character Usage: > * 9 - designates only numeric values > * L - designates only uppercase letter values > * l - designates only lowercase letter values > * A - designates only alphanumeric values > * X - denotes that a custom client script regular expression is > specified > * All other characters are assumed to be "special" characters used to mask > * the input component > * Example 1: > * (999)999- only numeric values can be entered where the the character > * position value is 9. Parenthesis and dash are non-editable/mask characters. > * Example 2: > * 99L-ll-X[^A-C]X only numeric values for the first two characters, > * uppercase values for the third character, lowercase letters for the > * fifth/sixth characters, and the last character X[^A-C]X together counts > * as the eighth character regular expression that would allow all characters > * but "A", "B", and "C". Dashes outside the regular expression are > * non-editable/mask characters. > */ > var InputTextMask = { > processMaskFocus: function(input, mask, clearWhenInvalid){ > // create an input mask and register it on the specified > input (if it hasnt already been added by a previous call > InputTextMask.createInputMask(input, mask, clearWhenInvalid); > if(input.value.length == 0){ > // when the input value is empty populate it with the > viewing mask and move the cursor to the > // beginning of the input field > var cursorPos = > InputTextMask.getCursorPosition(input, input.value); > input.value = input.mask.viewMask; > InputTextMask.moveCursorToPosition(input, null, > cursorPos); > } > }, > getEvent: function(e) { > // get the event either from the window or from the passed > event > return (typeof event != 'undefined')? event: e; > }, > handleEventBubble: function(keyEvent, keyCode){ > // this method ensures that the key enterned by the user is > not propagated unless it is a tab or arrow key > try { > if(keyCode && (keyCode.isTab || > keyCode.isLeftOrRightArrow)){ > // allow all tab/arrow keys by returning > true- no further action required > return true; > } > keyEvent.cancelBubble = true; > if(keyEvent.stopPropagation){ > // prevent other event triggers > keyEvent.stopPropagation(); > } > if(keyEvent.preventDefault){ > // prevent the default event from firing. in > this case it is propagation of the keyed input > keyEvent.preventDefault(); > } > return false; > } catch(e) { > alert(e.message); > } > }, > createInputMask: function(input, mask, clearWhenInvalid) { > // if this input hasnt already registered its mask go ahead > and do so now. This only needs to be performed the > // first time the input is encountered when it gains focus. > It will attach the MaskType object to the input object > // add add all of the appropriate event listeners to ensure > that the mask is applied > if(!input.mask || input.mask.rawMask != mask){ > in
Re: Input Text Mask?
would you be interested in making this a subclass of textfield and throwing it into wicketstuff-minis project which is in wicket-stuff? -igor On 10/18/07, William Hoover <[EMAIL PROTECTED]> wrote: > Is anyone interested in using the mask script (below) to a component in a > Wicket extension? The script prevents invalid input in a text field as the > user types (similar to the Atlas version: > http://www.fci.com.br/maskedit/MaskEdit/MaskEdit.aspx). I didn't see a > component in Wicket that would accomplish this out-of-the-box and thought it > would be a cool addition to Wicket. > > For example to force the input to mask a phone number: > > > /** > * InputTextMask script used for mask/regexp operations. > * Mask Individual Character Usage: > * 9 - designates only numeric values > * L - designates only uppercase letter values > * l - designates only lowercase letter values > * A - designates only alphanumeric values > * X - denotes that a custom client script regular expression is > specified > * All other characters are assumed to be "special" characters used to mask > * the input component > * Example 1: > * (999)999- only numeric values can be entered where the the character > * position value is 9. Parenthesis and dash are non-editable/mask characters. > * Example 2: > * 99L-ll-X[^A-C]X only numeric values for the first two characters, > * uppercase values for the third character, lowercase letters for the > * fifth/sixth characters, and the last character X[^A-C]X together counts > * as the eighth character regular expression that would allow all characters > * but "A", "B", and "C". Dashes outside the regular expression are > * non-editable/mask characters. > */ > var InputTextMask = { > processMaskFocus: function(input, mask, clearWhenInvalid){ > // create an input mask and register it on the specified > input (if it hasnt already been added by a previous call > InputTextMask.createInputMask(input, mask, clearWhenInvalid); > if(input.value.length == 0){ > // when the input value is empty populate it with the > viewing mask and move the cursor to the > // beginning of the input field > var cursorPos = > InputTextMask.getCursorPosition(input, input.value); > input.value = input.mask.viewMask; > InputTextMask.moveCursorToPosition(input, null, > cursorPos); > } > }, > getEvent: function(e) { > // get the event either from the window or from the passed > event > return (typeof event != 'undefined')? event: e; > }, > handleEventBubble: function(keyEvent, keyCode){ > // this method ensures that the key enterned by the user is > not propagated unless it is a tab or arrow key > try { > if(keyCode && (keyCode.isTab || > keyCode.isLeftOrRightArrow)){ > // allow all tab/arrow keys by returning > true- no further action required > return true; > } > keyEvent.cancelBubble = true; > if(keyEvent.stopPropagation){ > // prevent other event triggers > keyEvent.stopPropagation(); > } > if(keyEvent.preventDefault){ > // prevent the default event from firing. in > this case it is propagation of the keyed input > keyEvent.preventDefault(); > } > return false; > } catch(e) { > alert(e.message); > } > }, > createInputMask: function(input, mask, clearWhenInvalid) { > // if this input hasnt already registered its mask go ahead > and do so now. This only needs to be performed the > // first time the input is encountered when it gains focus. > It will attach the MaskType object to the input object > // add add all of the appropriate event listeners to ensure > that the mask is applied > if(!input.mask || input.mask.rawMask != mask){ > input.mask = new InputTextMask.MaskType(input, mask, > clearWhenInvalid); > // add the event listeners that will ensure that when > the input contains an incomplete mask it will be remove. > // Also, make sure that the keydown event is fired > from this point forward thus invoking the mask format. > if(input.addEventListener){ > // most doms > input.addEventListener('blur', > function(){input.mask.remo