Adding new validation |
How do I add a new form validation?
I have PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Code: But it is causing a Javascript error Code: array( Code: 'field' => 'order_first_name', Code: 'label' => 'First name', Code: 'rules' => 'trim|required|alpha_space' Code: ), Code: array( Code: 'field' => 'order_last_name', Code: 'label' => 'Last name', Code: 'rules' => 'trim|required|alpha_space' Code: ), (10-11-2021, 11:05 AM)Knutsford Wrote: How do I add a new form validation? It is Codeigniter 2 if that helps
Upgrading to 4 is on the cards sometime What I posted is what I tried and I was getting a JavaScript error - something to do with the order id which didn't make sense at all as it isn't part of the form. I am wondering if I should try callback instead
Maybe this has nothing to do with your problem, but “&” is a bitwise operator. You should use “&&” instead.
https://www.php.net/manual/en/language.o...itwise.php https://www.php.net/manual/en/language.o...ogical.php
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Yep you are right I have always had a problem with & and && for some reason. I tried doing the validation using callback last night but couldn't get it to work
I you don’t want to upgrade to CI4 at the moment, you should at least upgrade to CI3. The steps from CI2 to CI3 are quick and easy and you would at least have documentation for that version. Because CI2 is very outdated and the user guide is no longer available. So it’s hard to tell what’s wrong with your code.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Hmm some version upgrades are easy peasy but I don't remember going from 2 to 3 that easy when I have done it depending on how the site it has been written. Anyway I have got it working by being naughty and changing the core code which is what I aas trying to avoid.
Believe me, going from 3 to 4 is way more work than 2 to 3.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |