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

  • Home
  • SEARCH
  • 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 6475483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:42:36+00:00 2026-05-25T06:42:36+00:00

Using PyroCMS 1.3.1 I’ve built a model that’s pretty much a copy-paste version of

  • 0

Using PyroCMS 1.3.1 I’ve built a model that’s pretty much a copy-paste version of the included contact model, but with a few tweaks. When all fields are inputted correctly everything works as expected. If a field is left out or incorrectly filled in, the form does not submit – just as expected.

However, I can’t seem to get the form validation message to be outputted and this is driving me crazy. I’m sure I’ve just missed something very basic so if anyone could point it out I’d be grateful.

View file (form.php) contains this

<?php if (validation_errors()): ?>
<div class="error-box">
    <?php echo validation_errors(); ?>
</div>
<?php elseif (isset($messages['error'])): ?>
<div class="error-box">
    <p><?php echo $messages['error']; ?></p>
</div>
<?php endif; ?>

Controller (plugin.php) looks like this

class Plugin_mycustommodule extends Plugin {

private $rules = array(
    array(
        'field' => 'firstname',
        'label' => 'lang:mycustommodule_firstname_label',
        'rules' => 'required|trim|max_length[80]'
    ),
    /* ... snip ... */
    array(
        'field' => 'license',
        'label' => 'lang:mycustommodule_license_label',
        'rules' => 'required'
    )
);

public function __construct()
{
    $this->lang->load('mycustommodule');
}

function form()
{
    $this->load->library('form_validation');
    $this->load->helper('form');

    $this->form_validation->set_rules($this->rules);

    // If the user has provided valid information
    if ($this->form_validation->run())
    {
        /* ... Custom processing here ... */

        // The try to send the email
        if ($this->_send_email())
        {
            $message = $this->attribute('confirmation', lang('mycustommodule_sent_text'));

            // Store this session to limit useage
            $this->session->set_flashdata('success', $message);

            redirect(current_url());
        }
        else
        {
            $message = $this->attribute('error', lang('mycustommodule_error_message'));

            $data['messages']['error'] = $message;
        }
    }

    // Set the values for the form inputs
    foreach ($this->rules as $rule)
    {
        $form_values->{$rule['field']} = set_value($rule['field']);
    }

    $data['form_values']    = $form_values;

    return $this->module_view('mycustommodule', 'form', $data, TRUE);
}
  • 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-25T06:42:36+00:00Added an answer on May 25, 2026 at 6:42 am

    So it turns out that while I was working on customizing the CodeIgniters language files I must have messed up the upload of form_validation_lang.php because all entries was empty i.e. $lang['required'] = '';

    So basically the validator looked for the error message, found an empty string, which was trimmed from being outputted. As suspected something silly, just not in the place I expected.

    Let’s hope this post will save someone else the trouble.

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

Sidebar

Related Questions

I am using PyroCMS Version 1.1.0 . It has the navigation module that is
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active
I'm trying to use the PyroCMS Contact form in a facebook tab. When displaying
I've been working on a case using Pyrocms, a CI-based CMS, on my local
Pyrocms is using Dwoo template engine. In Dwoo, we can make inheritance template. {extends
I have started to use PyroCMS but I am unsure how to use the
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I

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.