orders.php - i/p validation

Open to all! Ask other shopowners for help.
Post Reply
Yahalimu
Member
Posts: 29
Joined: Mon Oct 26, 2020 1:27 pm
Phoenix Version: v1.0.5.0
Has thanked: 4 times
Been thanked: 1 time

orders.php - i/p validation

Post by Yahalimu »

Hello,
Some may remember, (probably on the old forum) I reported an issue (which was verified with others) on orders.php where if you put an extra space after an order number in the order no: input box, the page then slowly de-constructed in front of your eyes. Quite impressive but unwanted. Using Chrome anyway.
I'm sure this has been fixed in later versions but I have V.1.0.5.0.
Is there 'A-B,0-9' validation I could add to that input box? It happens fairly frequently as we copy and past order numbers.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Has thanked: 93 times
Been thanked: 162 times

Re: orders.php - i/p validation

Post by zipurman »

You could add something like this using a hook targeting the footer.

Code: Select all

<script>
    $(function(){
        $("input[name='update_name']").on("keyup", function(){
            var order_number = $(this).val();
            $(this).val(order_number.replace(/[^A-B0-9]+/g, ""));
        });
    });
</script>
Make sure to change the "input[name='update_name']" to what ever element target you are targeting.
zipurman
-----------


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply