Using the Client Extension Class

The RaxanClientExtension (CLX) class makes it very easy to manipulate client-side DOM elements on-the-fly. It does this by generating action scripts that are sent to the client's web browser for processing. Action scripts can be defined as a sequence of jQuery or native JavaScript function calls.

The C() function is available to developers as a wrapper to the RaxanClientExtension class.

In this example, we are going to use the CLX to set the html value the <div> tag and then fade in the result:



class MyPage extends RaxanWebPage {

    protected function _load() {
        // set the content of the page
        $this->content('<input id="mybutton" type="button" value="Click Me"  /><div id="msg" />');

        $elm = $this['#mybutton']; // select the mybutton input element 
        $elm->bind('#click','.buttonClick'); // bind to the mybutton click event using an ajax callback

    protected function buttonClick($e) {
        // select the #msg element on the client
        C('#msg')->html('Hello World')  // use the C() function
            ->hide()        // hide the element
            ->fadeIn(); // fade in the element.