Maximise input to 4

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 7 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10769
    JoshHH
    JoshHH
    Participant

    Dear staff,
    I’m using ASP on our site so that people can find the pages of our ‘workers’ by means of POSTAL CODE. (We had a mail conversation about this before I bought the plug-in). It works OK, but even though I state on the site and even in the search bar that people only have to fill in the digits of their postal code (so NOT the letters) there are people who don’t read and they fill in their whole code – and that will not give results. I am not planning to type all the possibilities of our postal code in the Netherlands so I’d rather have the possibility that people can only use 4 letters in their search. Is that possible? I couldn’t find it in the documentation, but maybe I overlooked it?!

    Ideal would be a small search bar with no looking glass – only fill in 4 digits and then…. bam, to the page.

    Any help will be greatly appreciated,
    kind regards,
    Josh Haijer

    #10772
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Josh,

    Well, there are no options to limit the maximum length nor the character input to numbers only, but it’s possible with a small custom script without touching the plugin code.

    Put this code into the functions.php file in your active theme directory (start copy from line 3):

    This will execute a small code snippet on page load, which validates the input for number only, and maximum length of 4.

    You also mentioned, you don’t need the magnifier, you can hide that on the Theme Options -> Search Text button panel: https://i.imgur.com/iWE3bAB.png
    (I’ve placed that option accidently to the wrong panel)

    I hope this helps!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.