• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
jquery post & ci form validation

#6
[eluser]Nick Husher[/eluser]
I don't think such a thing is possible without somehow decoding the JSON and inserting it into the $_POST associative array. The best way to do that might be by extending the Validation library with a MY_Validation class.

The code might look something like this:

Code:
//php
foreach($_POST as $key=>$property) {

    // json_decode returns null or a string if the json given to it is
    // invalid. see:
    // http://us2.php.net/manual/en/function.json-decode.php#86181
    //
    // the second argument forces json_decode to use an associative array
    // instead of a stdClass Object
    $json_object = json_decode($_POST[$property], true);
    $is_json = ($json_object != null && !is_string($json_object));

    if($is_json) {
        array_merge($_POST, $json_object);
    }
}


Messages In This Thread
jquery post & ci form validation - by El Forum - 01-21-2009, 08:00 AM
jquery post & ci form validation - by El Forum - 01-21-2009, 10:11 AM
jquery post & ci form validation - by El Forum - 01-21-2009, 12:17 PM
jquery post & ci form validation - by El Forum - 01-21-2009, 02:15 PM
jquery post & ci form validation - by El Forum - 01-22-2009, 03:06 AM
jquery post & ci form validation - by El Forum - 01-22-2009, 09:25 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.