I'm trying to implement this custom behavior
http://jsfiddle.net/FxEDf/ but I'm in troubles to bind the callback function to the source element.
It is supposed to work like this:
1) A form element (like a checkbox) fires an event.
2) The callback function is then executed upon that event. If it returns TRUE, the children of a container div are injected back into the DOM, otherwise they're removed.
The html should look like this:
<input type="checkbox" data-behavior="ConditionalField" data-ConditionalField-event="change" data-ConditionalField-target="target_elem" data-ConditionalField-callback="function(){ return TRUE};" />
My problem is that api.get('callback') returns the function as string, and passing that string to eval() doesn't seem to achieve the desire casting to Function.