Clearing the Contents of the Signature Control

Add JavaScript to clear the contents of a signature control.

  1. Use the Hybrid App Generation wizard to generate the Hybrid App package and its files.
    When the Hybrid App package is generated, the Custom.js file is generated if not already present in the project. The Custom.js file is located in Generated Hybrid App\<project_name\html\js.
  2. Open the Custom.js file and add your JavaScript code to the click event of a menu or button.
    For example:
    function customAfterMenuItemClick(screen, menuItem) {
        if (menuItem === "Clear_Signature") {
            $.data(document.getElementById('sigKey'), 'signature').clearSignature();
        }
    }
  3. Save and close the Custom.js file.
  4. Re-generate the Hybrid App package and deploy it to SAP Mobile Server.