Cjax Framework


Value Modifiers (Cjax 5.4+)

Value pharser allows you to pass values within the url, for example:

ajax.php?controller/function/|some_field|

That 'some_field' is looked for by id then processed and the value of that field is passed in the final url to process. Now value modifiers are functions and function references that you can pass along the field id to apply functionality to that value.

Apply modifiers

Lets say for example that you want a value to be escaped when passed, then you could do this:

ajax.php?controller/function/|some_field:escape|

ajax.php?controller/function/|some_field:escape:toLowerCase|

The value is passed through the function modifier. You may specify multiple JavaScript function modifiers. You can even go as far as passing a full function in there, as follows:

ajax.php?controller/function/|some_field:function(value) { value = value.replace(/a/g,'');return value;}|

Avoid passing ":" character

The only condition to the value modifiers is that you do not pass a ':', this is because this character is a seperator and if you pass it, the interpreter will think you are spliting the characters there.

Previous Topic:  Previous Class    ·   Top of Page   ·   Demos Home   ·  

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax