Results 1 to 6 of 6

Thread: [Answers] Inputmask

  1. #1
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135

    [Answers] Inputmask

    Here are a few special input masks that I think are worth mentioning as they are time savers.

    Convert all input to uppercase:
    Code:
    @!
    Accept alpha characters only:
    Code:
    @A
    Accept alphanumeric:
    Code:
    @X
    ISO date YYYY-MM-DD:
    Code:
    @D
    Integer value with maxlength,minvalue,maxvalue:
    Code:
    @I10,100,1000
    Double value with maxlength,maxdecimals,minvalue,maxvalue:
    Code:
    @F10,2,0,10000
    Valid email address:
    Code:
    @E
    Any regular expression starts with a ?. The example below validates an email address:
    Code:
    ?\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b
    VFP-style picture characters:
    Code:
    !
    A
    9
    X

    Q:
    Inputmask to "99 9999" or "99/9999"
    A:
    It won't put the actual '/' in using the Input mask, but you can use a 'regular expression' Input mask to check for the correct entry. This would be the Input mask for 2 digits followed by a slash followed by 4 digits, the '/' prefix indicates the regular expression:
    Code:
    ?[0-9]{2}/[0-9]{4}
    Maybe this in combination with 'Placeholder text' to show the format?



    (999) 999-9999 as the Input Mask
    your input mask there is correct. If you enter this as a input mask on a form field it will format the data as you require.
    If you have set the mask in the data dictionary make sure you have "inherit dictionary rules" set to true under "other options" for the form section.



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    Last edited by josipradnik; 2016-11-16 at 03:34.

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    I have a textbox placed in a canvas section that is to display a Canadian Postal Codes.
    If I have the mask set as: A9A9A9 it does work however, how do I set the mask to accept a space: A9A 9A9?

    I'm assuming a regular expression would work better although I'm not sure how to add the space (I believe it's used as \s).
    I'm guessing it would be something similar to ?[A-Za-z]{1}[0-9]{1}[A-Za-z]{1}[0-9]{1}[A-Za-z]{1}[0-9]{1}.
    Any other suggestions on how to handle a postal code
    A:
    For the space in the regular expression, you can just include a space. I came across this one, which looks like the sort of thing you need, although if you want to allow lower case, you'll have to add that in.

    ?[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d

    That one apparently takes into account that not all of A-Z are valid starting characters.

    Make sure you set a default, e.g. space(7) if it is not data bound.
    the '?' prefix is added for Lianja to indicate that the mask is a regular expression

    Code:
    ?^((\d{5})|(([ABCEGHJKLMNPRSTVXY]|[abceghjklmnprstvxy])\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])(\s|)\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])\d))$
    For anyone else following along, here is a regular expression that should handle most current zip codes or postal codes (case insensitive although UPPER CASE is the standard method).

    Code:
    ?^(((\d{5})(?:[-\s]*(\d{4})))|(([ABCEGHJKLMNPRSTVXY]|[abceghjklmnprstvxy])\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])(\s|)\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])\d))$
    [EDITED] see next Cory's post:
    Regular expression input masks are not supported in Web/Mobile Apps.


    issue with the Currency mask in a Grid Section Column was resolved in a subsequent release.





    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    Last edited by josipradnik; 2016-11-16 at 03:30.

  3. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Additional information from a ticket:

    Regular expression input masks are not supported in Web/Mobile Apps.
    The code ignores desktop style regular expression input masks so it will not have any effect in web or mobile apps.

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,142
    Blog Entries
    22
    This is due to a lack of standardization on regular expressions between different languages.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #5
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    to define picture (number format) for total section of the grid so that I can display numbers in 999,999,999.99 format.
    A:
    transform({},"999,999,999.99")
    There is a limit on the total display size, if your total is too large to display, have a look at the suggestions here:
    http://www.lianja.com/community/show...-column-totals



    Input masks for currency are not currently available in the web / mobile UI framework.
    Currency masking is locale dependent



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...p?2717-Answers

  6. #6
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    It seems that using "input mask" control will result in textbox field being disabled (cannot key in anything) in web view mode. So any other ideas how can to control user inputs?



    How do we know exactly which design time tools can be applied to web/mobile app?

    A:
    If you change the @! to !!!!!! (the number of characters allowed) that works.
    When using the @ functions the length of the field needs to be known and if there is no control source bound to it it does not know.



    Q:
    allowing only numbers? I tried "999" to no success.

    A:
    Try @F
    Even maxlength,maxdecimals,minvalue,maxvalue can be specified:
    e.g.
    Code:
    @F10,2,0,10000
    http://www.lianja.com/doc/index.php/Input_Masks

    Some input masks are not supported in web/mobile
    client yet
    More info: http://www.lianja.com/community/show...wers-Inputmask
    [EDIT] Sorry, my example works only in desktop. Stick with pure @F

    A2:
    @F10,0 and that will work in all clients.




    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352

    These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.co...ory/inputmask/

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us