Welcome Guest, Not a member yet? Register   Sign In
Need Help... problem with hmvc and form_validation callback....
#1

[eluser]psychoder[/eluser]
hello guys, my form validation callbacks seems not triggered...
here is the codes... im using hmvc

controller
Code:
$this->form_validation->set_rules('name', 'Name', 'required');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        $this->form_validation->set_rules('message', 'Message', 'required');
        $this->form_validation->set_rules('captcha', 'Captcha', 'required|callback__captcha_check');

        if ($this->form_validation->run() == true)
        {
            $message = array(
                'username' => $this->input->post('name'),
                'email' => $this->input->post('email'),
                'message' => $this->input->post('message'),
                'date_send' => now(),
                'status' => 0
            );
            $this->messages_model->insert_message($message);
            $this->session->set_flashdata('contact_error', 'Message Sent...');
            $this->session->set_flashdata('success', TRUE);
            redirect('contact');
        }
        else
        {
            if ($this->captcha->create())
            {
                $data['captcha'] = $this->_captcha_img_html($this->captcha->html_data);
            }
            else
            {
                $data['captcha'] = 'Captcha : ' . $this->captcha->debug;
            }
            $data['error'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('contact_error');
            $data['success'] = $this->session->flashdata('success') ? $this->session->flashdata('success') : FALSE;
            $data['uname'] = array(
                'name' => 'name',
                'class' => 'input_text ui-widget-content ui-corner-all',
                'value' => $this->form_validation->set_value('name')
            );
            $data['email'] = array(
                'name' => 'email',
                'class' => 'input_text ui-widget-content ui-corner-all',
                'value' => $this->form_validation->set_value('email')
            );
            $data['captcha_t'] = array(
                'name' => 'captcha',
                'class' => 'input_text ui-widget-content ui-corner-all'
            );
            $data['message'] = array(
                'name' => 'message',
                'class' => 'form_textarea ui-widget-content ui-corner-all',
                'value' => $this->form_validation->set_value('message')
            );

          
            $this->template
                    ->title('example', 'Contact ')
      
                    ->set_partial('menu', 'partials/menu')
                    ->set_partial('footer', 'partials/footer')
                    ->set_partial('content', 'partials/contact_form', $data)
                    ->build('dummy');
        }


callback

Code:
function _captcha_check($captcha)
    {
        if ($this->captcha->check($captcha))
        {
            return TRUE;
        }
        else
        {
            $this->form_validation->set_message('_captcha_check', 'Please enter the word correctly.');
            return FALSE;
        }
    }
#2

[eluser]Jason Stanley[/eluser]
I haven't used HMVC in ages. I do vaguely remember having to update the form validation library. Have you done this?

I don't know if this works or not. Some additional Googling would help you if this doesn't.

http://ellislab.com/forums/viewthread/143057/#702683
#3

[eluser]psychoder[/eluser]
thanks... great help...

but still not working... im using modular extension
#4

[eluser]vbsaltydog[/eluser]
I have form validation callbacks working under HMVC. Please post your latest code.
#5

[eluser]psychoder[/eluser]
what are the changes that you have made to triggered callbacks?

please guide me...

code are still the same( the one posted above ), don't know where to start
the changes..
#6

[eluser]CroNiX[/eluser]
If you do a bit of searching....I think the author of HVMC answered this question a few days ago...
#7

[eluser]vbsaltydog[/eluser]
Its also documented in the HMVC wiki.
#8

[eluser]Sven Delle[/eluser]
The wiki 'solution' is working!




Theme © iAndrew 2016 - Forum software by © MyBB