jQuery UI Widgets Forums Editors MaskedInput Masked input ip address

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  PiDome 7 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Masked input ip address #49677

    PiDome
    Participant

    Hi All,

    I want to use the masked input for exmple for users to fill in an ip address, but there are some odd or developers intended results.

    I already understand that the use of real regular expressions is not applicable, for example a very simple regex:

    $(field).jqxMaskedInput({ width: 250, height: 25, mask: '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}', theme: siteSettings.getTheme()});
    $(field).jqxMaskedInput({value: $(field).val() });
    

    results in the input field: “1{1,3}.9{1,3}.2{1,3}._{1,3}” (also pressing ctrl+c now on this fields yields an: “Uncaught TypeError: Cannot call method ‘setData’ of undefined at line ‘7’ in file: ‘http://192.168.1.6:8080/shared/js/jq/jqx-all.js’.”

    Also using for example [0-9].[0-9].[0-9].[0-9] does not let a user type a dot where the cursor moves to the next field behind a dot. But this can be just a feature request if it was never intended to work this way.

    When i use the above “regex” and want to set the value: “192.168.1.7” only the first “192” is shown.

    Also the above regex implies that the you MUST have 3 characters before the first dot instead of optional, if i would enter 010.001.7.1 i’m defining an possible octal instead of a decimal which could lead to wrong parsing of the ip address

    Is it possible to use the masked input as a visual representation for ip addresses as the example on the website implies?

    Best regards,
    John.

    Masked input ip address #49679

    Peter Stoev
    Keymaster

    Hi John,

    The use of real regex is indeed not applicable. You can only restrict the numbers interval as shown on our demo.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Masked input ip address #49681

    PiDome
    Participant

    Hi Peter,

    Thank you for the response. To better understand the mask are the masked characters included or excluded in the value and only for visibility purposes?

    And is it then possible to use the jqxinput and apply custom handlers and create a custom masked input?

    Best regards,
    John.

    Masked input ip address #49682

    PiDome
    Participant

    Hi Peter,

    I already have it working with custom handlers on, for example, my ip address input field with an jqxinput.

    Thank you in advance for your time.

    John.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.