How to include custom javascript function in Server Mobile Application HTML5 Builder

StackOverflow https://stackoverflow.com/questions/16566219

  •  29-05-2022
  •  | 
  •  

Pergunta

We are developing a Server Mobile Application, currently there are no server side implementation as yet.

I would like to use my own function on a Javascript MButton1JSClick event, like in the code below:

The question is, where do I put the actual function code for myFunction()

<?php
require_once("rpcl/rpcl.inc.php");
//Includes
use_unit("jquerymobile/forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
use_unit("jquerymobile/jmobile.inc.php");

//Class definition
class MPage1 extends MPage
{
    public $MButton1 = null;
    function MButton1JSClick($sender, $params)
    {
        ?>
        //begin js
            myFunction();
        //end
        <?php
    }
}

global $application;

global $MPage1;

//Creates the form
$MPage1=new MPage1($application);

//Read from resource file
$MPage1->loadResource(__FILE__);

//Shows the form
$MPage1->show();

?>

Any help will be much appreciated, thanks.

Foi útil?

Solução

You can define your JavaScript functions in a separated client unit (JavaScript file).

Documentation: Client Unit.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top