#1 2010-07-07 13:00:26

hort
Member
From: Portugal
Registered: 2010-06-16
Posts: 18

Sucess message after submiting form

HI ionize fans!

I have a form which is validated by the controller below it sends emails but does not shows the "sucess" message.

I have placed the contact_form_success.php file inside the articles folder in my theme

I got no error when submiting the form.

What could be wrong??

Thanks.
hort


    function candidate()
    {
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
            

        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        $this->form_validation->set_rules('check', 'check', 'callback_antispam');

        // Delimiters for individual error messages : Put to nothing, task of the FTL tag
        $this->form_validation->set_error_delimiters('', '');
        // FAILS
        if ($this->form_validation->run() == FALSE)
        {
            // If request cames from XHR, send just the form again
            if ($this->is_xhr() === true)
            {
                $this->render('articles/register', $this->context);
            }
            // Else, ensure the validation data are kept and redirect to the refering page
            else
            {
                // Put the validation_errors string message to the flash session
                $this->session->set_flashdata('validation_errors', $this->form_validation->error_string());
                // Put the form field data array to the flash session
                $this->session->set_flashdata('field_data', $this->form_validation->_field_data);
                redirect($_SERVER['HTTP_REFERER']);
            }
        }
        // SUCCESS
        else
        {
          $this->send_mail();
            // Render the message
            $this->render('articles/contact_form_success', $this->context);
            
        }
    }

Offline

#2 2010-07-20 03:11:22

bindaden
Member
Registered: 2010-04-25
Posts: 8

Re: Sucess message after submiting form

You did a good job, I'll try with your code. Thanks.

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations