Welcome Guest, Not a member yet? Register   Sign In
Global form validation callbacks? Staged forms?
#6

[eluser]tomclowes[/eluser]
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed.');

class MY_Form_validation extends CI_Form_validation
{

  function MY_Form_validation() {
    parent::CI_Form_validation();
  }
  
        //FUNCTION FOR CHECKING IF THE CAPCHA IS RIGHT
        function capcha_check($str)
        {
            $CI =& get_instance();

            //IF SUBMITTED VALUE IS EQUAL TO THE FLASH SESSION DATA SET
            if ($str == $CI->session->flashdata('capcha'))
            {
            
                return TRUE;
            }
            else
            {
                //SET THE ERROR MESSAGE
                $CI->form_validation->set_message('capcha_check', 'Your answer to the %s question was incorrect.');
                return FALSE;
            }
        }
        

  }

This is my code, which I am confident is correct..
I have my form valiation rules in a seperate config file.


--------------------------------------------------------------------------------------

Apologies for drilling your brains. These will be the last questions Smile - I do appreciate it.

I am working with various javascript files for my development. I have them in a folder called js in my base directory.
I am utilizing ajax for various update processes, so I also have php files in this folder with which my js communicates to update databases etc.

Am I approaching this correctly?

Assuming that I am, how can I access codeigniter functions/sessions etc from here?

For example, I have a simple JS which means onclicking a button, a value is added to the database. I want to also input the username which is stored in a codeignitor session. Is there anyway to access this from such a file in such a setup?

Likewise I want to utilize the base_url function in my Javascripts so that i dont have to continually update my paths when things are changed. Is this possible?

Thanks a lot.


Messages In This Thread
Global form validation callbacks? Staged forms? - by El Forum - 09-03-2010, 01:35 PM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 04:23 AM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 04:51 AM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 06:35 AM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 07:22 AM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 08:21 AM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 10:25 AM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 12:21 PM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 12:38 PM
Global form validation callbacks? Staged forms? - by El Forum - 09-04-2010, 04:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB