Tutorial  


Home  -   Online Examples


   Some Prerequisits


  

Simple Usage:

   
1.  In HTML file include the rspa.js

           <script language="JavaScript" type="text/javascript"src="rspa/rspa.js"></script>
  
2. Provide ID and name for controls like:

               <inputname="text1" id="text1" value="20">
                <input name="text2" id="text2" value="30">
                 Result:  <input name="text3" id="text3" >
 

3. Call server functions from javascript events

              <inputtype="button" id="button1" value="Calculate"  onclick=" new RSPA.Execute('MyClass.multiply()') ">


4. Create the PHP class MyClass  in MyClass.class.php


            <?php

               require_once("rspa/components/Form.class.php");

              class MyClass  extends Form{

  
                         public function multiply(){

                                     //Syntax PHP5
                                      $val = $this->text1->value * $this->text2->value;
                                      $this->text3->value =   $val;

                             //Syntax PHP4
                             //$val = $this->controls[ "text1" ]->getValue() * $this ->controls[ "text2" ]->getValue();
                             //< $this ->controls["text3"]->setValue( $val );
       
                       }
   
   
             }

        ?>

  5. Change the configuration value in rspaconf.inc.php

        $RSPA['class_folder']  has to set to the folder containg your class files.

        $RSPA['class_extension'] = ".class.php"; //Extension of your class files




Syntax of calling Execute:

new RSPA.Execute('Class.function', {option :value,...});

Applicable oprtions :
      
     
debug:           //Whether to show debug window(true/false). Default is false
      loadStatus:   //Status message to be displayed while waiting for execute. Default 'Loading...'
      statusPane:  //Where to show status message . Default is '__RSPA__loadStatus',
      widget:           //ID of the parent component whose child values to be passed to server for execution. Default is  document. By default it will pass all components you can restrict it by using a div to nest components.
      parameters:  //An array of parameters to be passed to server function. Default is empty array (new Array())
      controller:     //Relative location of RSPA controller on server. Default:  "rspa/framework/Controller.php"
   
     oncomplete:  // Client side function to execute after getting result from server. Default is null

IncludeFilePHPClass:
ClassPath:
PHPClassInSession:
PHPClassInSessionName:
onBeginRequest:
onCompleteRequest:
get:
onFailure: