Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5841993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:57:37+00:00 2026-05-22T11:57:37+00:00

As the subject say… How to set form validation rules to whole form instead

  • 0

As the subject say… How to set form validation rules to whole form instead of form field in code-igniter ?

// Définir les règles de validation du formulaire de création de compte
$this->form_validation->set_rules('username', 'Nom d\'usagé', 'required');
$this->form_validation->set_rules('password', 'Mot de passe', 'required|callback_authentification_check');

Consider this code above.. it call callback_authentification_check to check if username and password match.. however it SHOULDNT be attached to the password field since this is an overall form validation process.

So what is the best way to do this ?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:57:38+00:00Added an answer on May 22, 2026 at 11:57 am

    Simply put, let the normal form validation rules run, then run your “callback” after the fields have been checked for validity, instead of as a form validation rule:

    if ($this->form_validation->run() && my_callback() == TRUE)
    {
        // OK!
    }
    

    However:

    There’s nothing “wrong” with the way you’re doing it now, but I see your concern. Validation rules run in the order they are defined, so if you run your callback last, you’ll be sure that you’re dealing with “valid” data as defined by your previous rules. You can still access the other $_POST data from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say that I have the form below: <form action=sendMessage.php method=post> <label>Subject</label><input type=text></input> <label>Message</label><input
The subject doesn't say much cause it is not easy to question in one
Say if I listen for an event: Subject.NewEvent += delegate(object sender, NewEventArgs e) {
The Django docs say this on the subject: Note also that Django stores signal
Let's say I have two tables, news and comments. news ( id, subject, body,
Does Indy9 have any way to get a specific raw email header (say, Subject
I have a table say : id| AccID | Subject | Date 1 |
i'm having a memory issue while testing a find/replace function. Say the search subject
Diving into vs2010 Extensibility and I gotta say the subject seems to be as
I know that E&C is a controversial subject and some say that it encourages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.