Page 1 of 1

orders.php - i/p validation

Posted: Thu Sep 30, 2021 1:48 pm
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.

Re: orders.php - i/p validation

Posted: Fri Oct 01, 2021 1:22 am
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.