Post by cahedral » Thu Jun 10, 2021 10:27 pm

Nowadays Opencart use "ajax" to validate forms.

In 2020 exists funcion in controller to validateForm() and avoid send data, but now,

how can I avoid send data to DB if exist error in form?

Thanks

Newbie

Posts

Joined
Thu Feb 18, 2021 7:47 am

Post by straightlight » Thu Jun 10, 2021 10:35 pm

cahedral wrote:
Thu Jun 10, 2021 10:27 pm
Nowadays Opencart use "ajax" to validate forms.

In 2020 exists funcion in controller to validateForm() and avoid send data, but now,

how can I avoid send data to DB if exist error in form?

Thanks
OC version. Just look in the core files for: json['error'] keys ... full of examples in there ...

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cahedral » Fri Jun 11, 2021 3:43 am

I've coded in admin\controller\localisation\language.php in save() function to validate when Save properties for example "enable/disable" language:

.... if (xxxx) then
$json['error'] = "string error"
else
"no error"


But when I set json[error] in php, ajax always store in database, but I need avoid store in database when $json['error'] is set. Now only show "tooltip error message"

How can I do it?

Newbie

Posts

Joined
Thu Feb 18, 2021 7:47 am

Post by straightlight » Fri Jun 11, 2021 6:36 am

cahedral wrote:
Fri Jun 11, 2021 3:43 am
I've coded in admin\controller\localisation\language.php in save() function to validate when Save properties for example "enable/disable" language:

.... if (xxxx) then
$json['error'] = "string error"
else
"no error"


But when I set json[error] in php, ajax always store in database, but I need avoid store in database when $json['error'] is set. Now only show "tooltip error message"

How can I do it?
You could always create a new service request in the Commercial Support section of the forum, or send me a PM directly from the forum, to have this issue solved as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cahedral » Fri Jun 11, 2021 4:39 pm

SOLVED.

Newbie

Posts

Joined
Thu Feb 18, 2021 7:47 am

Post by straightlight » Fri Jun 11, 2021 5:07 pm

Now that the issue has been solved with only one word, please add: [SOLVED] at the beginning of the subject line on your first post.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Semrush [Bot] and 256 guests