• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling index() on form validation failure

#11
Hi, sorry for the delay:
CI 3.1.

I have already added the error to /system/language/english/form_validation_lang.php

Custom Helper (which worked for non-required as a callback_ when in the controller):


PHP Code:
if ( ! function_exists('customAlpha')) {
 
   function customAlpha($str)
 
   {
 
       if (!preg_match('/^[a-z .,\-\']+$/i'$str)) {
 
           return FALSE;
 
       } else {
 
           return TRUE;
 
       }
 
   }

Reply

#12
Hi,

I would try to change the function so it return true no matter what.

You should not modify any files in the system folders EVER.
A good decision is based on knowledge and not on numbers. - Plato

Reply

#13
salain, that helped once again. Problem was the regex. This is what I have ended up with....
seems to work with textareas as well:


PHP Code:
if ( ! function_exists('customAlpha')) {
 
   function customAlpha($str)
 
   {
 
       if (!preg_match('/^[a-zA-Z0-9 .,\-\']*$/m'$str)) {
 
           return FALSE;
 
       } else {
 
           return TRUE;
 
       }
 
   }

Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.