⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to use preping functions in grocery crud form validation?



fbn

fbn
  • profile picture
  • Member

Posted 25 March 2015 - 12:43 PM

Hi,

 

How to use preping functions in set_rules like xss_clean, prep_for_form, prep_url, strip_image_tags and encode_php_tags?

 

Example:

 

$crud->set_rules('name', 'Name', 'required | prep_for_form'); does not work.

 

If i make this:

 

$crud->set_rules('name', 'Name', 'required | callback_prep_for_form');

 

function callback_prep_for_form ($string) {

 

$string = $this->form_validation->prep_for_form($string);

 

return $string

 

}

 

Is correct?