Page 1 of 1

How to "dublicate" an input field in checkout page and make it check for similar input?

Posted: Thu Feb 16, 2017 9:05 pm
by Vindojeens
Hey,
the situation is the following:

We use guest checkout without registration and the most important value for us is the phone number of the customer (so we can callback).
The problem is, people sometimes make typos and we cannot fullfil the order.

What I would like to do is add a second phone number field below the first one and make people enter their number twice, then make the fields check for similar input. Like password fields on some websites.

Someone can help me with it?

Help is much apreciated!! :)

Re: How to "dublicate" an input field in checkout page and make it check for similar input?

Posted: Sat Feb 18, 2017 4:18 am
by JDECLEMENTI
What opencart version?? I might be able to throw a quick mod together for you. seems simple enough

Re: How to "dublicate" an input field in checkout page and make it check for similar input?

Posted: Sat Feb 18, 2017 4:45 am
by JDECLEMENTI
you could just code it yourself and edit the template files

add this after the phone input

Code: Select all

<div class="form-group required  col-md-6">
                  <label class="control-label" for="input-payment-telephone-verify">Telephone Verification</label>
                  <input type="text" required="required" id="input-payment-telephone-verify" oninput="check(this)" class="form-control">
                  <script language="javascript" type="text/javascript">
    function check(input) {
        if (input.value != document.getElementById('input-payment-telephone').value) {
            input.setCustomValidity('Telephone Must be Matching.');
        } else {
            // input is valid -- reset the error message
            input.setCustomValidity('');
        }
    }
</script>
                </div>

Re: How to "dublicate" an input field in checkout page and make it check for similar input?

Posted: Sun Feb 26, 2017 5:43 pm
by Vindojeens
Thanks you 2. I'm using 2.3.0.2