• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form validation custom message

I'm using a Rule group for my form validation but I need a custom message for one of the rule. I tried looking through the documentation but nothing was mentioned about this type of use-case. Could anyone help me out on how to go about this: Form Validation -> Rule Group -> Custom Message

Attached Files Thumbnail(s)

$this->form_validation->set_message() ought to do the trick.

Form Library provides set_message() method to set message on validate rule, even run CI native rule or custom created rule, see below example

PHP Code:
# required is rule name
# 2nd param for custom message and "%s" for field name.
$this->form_validation->set_message('required''%s required'); 
Passionate PHP Programmer & Codeigniter Developer :- Always happy to help you!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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