Capture IP Address using Mask plugin

Capture IP Address using Mask plugin

beerygazbeerygaz Posts: 16Questions: 9Answers: 0

I'm using the mask plugin to add a mask to an editor field, but the data captured does not contain the periods in the mask. Am I missing something simple? How are other users capturing IP addresses in a method that assists the user?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    What mask are you using? The IP address example on the Mask site appears to be using:

    $('.ip_address').mask('099.099.099.099');
    

    Allan

  • beerygazbeerygaz Posts: 16Questions: 9Answers: 0

    Allan, I'm using that exact mask. I enter the data in the editor and it shows the correct mask, but the data stored in the database and reflected in the resulting datatable shows just the digits (so if I entered 192.168.1.1, I see 19216811)

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Ah I see! The mask is just a display formatter - it doesn't actually alter the value at all. At least not as far as I am aware.

    Imagine for example a credit card number: 0123 4567 8901 2345. The mask plug-in would lay it out with the spaces, but the server would see it without the spaces (which is what would be wanted for that case).

    I might be wrong, but I don't see an option in their documentation about being able to get the value as the formatted value. That might be something you need to direct to the developer.

    Allan

  • beerygazbeerygaz Posts: 16Questions: 9Answers: 0

    Thanks Allan, I figured as much after some more fiddling. I'll reach out to the dev.

This discussion has been closed.