Post by xinxilas » Tue May 22, 2018 2:20 am

Im trying to change some fields, but when i do it i have some colaterals

Example
If i change email field Input type to type="email"
<input type="email" name="email" value="" placeholder="{{ entry_email }}" id="input-payment-email" class="form-control" />
I receeive this error after subit form

Code: Select all

"SyntaxError: Unexpected token < in JSON at position 0"
.. the error is at line 120 of register.php controller:

Which is this line:

Code: Select all

if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}
Another example is if i change Telephone field input from text to type"tel"

I really need to change this inputs, so when the costumer is accessing from an mobile device, it would display the numeric keyboard

Can someone help me?

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by xinxilas » Tue May 22, 2018 2:59 am

The erro comes from $this->request->post['email'])
or $this->request->post['telephonel'])

Only because i've changed the input type

At Account / register.twig / php works okay

The problem is at account / checkout

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by DigitCart » Tue May 22, 2018 3:01 am

Hi,
Are you editing register form in checkout?

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by sw!tch » Tue May 22, 2018 3:12 am

If you are editing the checkout register then I suggest you look at the Ajax data in checkout.php.

For reference you can see the Ajax function here:

https://github.com/opencart/opencart/bl ... #L207-L211

You will need to append email as a data field.

(e.g for email ....

Code: Select all

data: $('#collapse-payment-address input[type=\'text\'], #collapse-payment-address input[type=\'email\'], #collapse-payment-address input[type=\'date\'], #collapse-payment-address input[type=\'datetime-local\'], #collapse-payment-address input[type=\'time\'], #collapse-payment-address input[type=\'password\'], #collapse-payment-address input[type=\'hidden\'], #collapse-payment-address input[type=\'checkbox\']:checked, #collapse-payment-address input[type=\'radio\']:checked, #collapse-payment-address textarea, #collapse-payment-address select'),
Note the addition of #collapse-payment-address input[type=\'email\'], the same with need to be done for tel.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by xinxilas » Tue May 22, 2018 3:29 am

Thank you,

just discovered this, I came to post the solution and you already answered.

Added :
#collapse-payment-address input[type=\'tel\']
#collapse-payment-address input[type=\'email\']

Thanks!

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am
Who is online

Users browsing this forum: No registered users and 209 guests