how can I allow epmty value in matches[] rule in validation? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: how can I allow epmty value in matches[] rule in validation? (/showthread.php?tid=29417) |
how can I allow epmty value in matches[] rule in validation? - El Forum - 04-09-2010 [eluser]suba[/eluser] Hi . CASE 1 ----------- I used form validation class. I want to check only value should be either A, B , C , D or empty values. How can i use in form validation rule in form validation.? please advise me. CASE 2 ---------- I want to allow empty value and number only. How can i use this case? how can I allow epmty value in matches[] rule in validation? - El Forum - 04-09-2010 [eluser]WanWizard[/eluser] Simply do not include 'required' in your rule to allow an empty value. If empty, no further validations will be executed. how can I allow epmty value in matches[] rule in validation? - El Forum - 04-09-2010 [eluser]suba[/eluser] Hi, Thanks. I did not put required in rule. If the field is empty, there is no error message. If the field has non empty AND has A or B or C or D there is no error message. If the filed has non empty and other than A OR B or C or D, there is error message. I want to check other than empty , A, C ,D values. Code: $this->form_validation->set_rules('mark','mark','matches[ABCD]'); how can I allow epmty value in matches[] rule in validation? - El Forum - 04-09-2010 [eluser]WanWizard[/eluser] Me confused. First, you said you wanted to accept Empty, A, B, C and D as valid. Which is what your rule does. Now you state that you want to do the opposite, ie empty, A, B, C and D means error, all other values are fine? |