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

[eluser]WanWizard[/eluser]
Nothing wrong with this code, I agree. Should work without problems.
Does your rule include 'required' (to make sure it isn't skipped because of a form error)?

There are several approaches to the ajax question.

Separate PHP files work if you don't need access to the CI object, but not my favorite because your code is all over the place. If you need the CI object, you have to call a controller. Some use separate methods in their application controllers to deal with ajax calls (http://host/controller/ajax/var/value).

Because I use Modular CI in my projects, there is no such thing as a single controller that processes a page request. Instead, a page is build using different sections using a template system, each section being produced by a different controller. I use a specific front controller (ajax.php instead of index.php), that takes care of all ajax calls, using a URI like http://host/ajax.php/modulename/method/var/value, which calls the method method() in the controller ajax.php in the requested module. So I centralize all ajax code for a given module in a single controller per module.

My header template contains a piece of javascript that creates an "exitecms" javascript object. This object has a method called base_url() which returns the CI base_url. I call this method from other javascript components.
Something like:
Code:
var exitecms = new function() {
    this.base_url = function () {
        return "<?php echo base_url() ?>";
    };
}


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