Mind maps on forms

In this tutorial we will see the steps that must be followed to create a form with a mind map.

Creation of a Blank application that will be called from the Form

1 – In the OnExecute event we add the following code

?><!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

<link rel="stylesheet" type="text/css" href="<?php echo sc_url_library('prj', 'mindmap_chart', 'jsmind.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo sc_url_library('prj', 'mindmap_chart', 'jsmind-index.css'); ?>" />

    <div id="mindmap">

<script type="text/javascript" src="<?php echo sc_url_library('prj', 'mindmap_chart', 'jsmind.js'); ?>"></script>
<script type="text/javascript" src="<?php echo sc_url_library('prj', 'mindmap_chart', 'jsmind.draggable.js'); ?>"></script>
        var mind_data = {
                "name":"jsMind remote",
                    {"id":"easy1","topic":"Easy to show"},
                    {"id":"easy2","topic":"Easy to edit"},
                    {"id":"easy3","topic":"Easy to store"},
                    {"id":"easy4","topic":"Easy to embed"},
                    {"id":"other3","background-image":"http://placehold.it/150/C0CCDA/", "width": "150", "height": "150"}
                    {"id":"open","topic":"Open Source","direction":"right","children":[
                    {"id":"open1","topic":"on GitHub", "background-color":"#eee", "foreground-color":"blue"},
                    {"id":"open2","topic":"BSD License"}
                    {"id":"powerful1","topic":"Base on Javascript"},
                    {"id":"powerful2","topic":"Base on HTML5"},
                    {"id":"powerful3","topic":"Depends on you"}
                    {"id":"other","topic":"test node","direction":"left","children":[
                    {"id":"other1","topic":"I'm from local variable"},
                    {"id":"other2","topic":"I can do everything"}

        var mind_options = {
            container: 'mindmap',
            theme: 'scriptcase',
            editable: true

        var mind = jsMind.show(mind_options,mind_data);
        var mind_tree = {};

            // Actual items
            mind_tree = JSON.stringify(mind_tree.data);

            // Append menu
            $('jmnode').append('<div class="node-menu"><span></span><ul><li class="item-add"><a href="#">New node</a></li><li class="item-del"><a href="#">Remove node</a></li></ul></div>');
            // Open Menu
            $('jmnode .node-menu span').click(function(e){

            // Refresh node tree
            function refreshMindTree() {
                mind_tree = jsMind.current.get_data();
                mind_tree = JSON.stringify(mind_tree.data);
            // Add item
            $('.item-add a').click(function(e){

                var node_selected = mind.get_selected_node();
                var node_topic = 'test';
                var node_id = jsMind.util.uuid.newid();

                mind.add_node(node_selected, node_id, node_topic);
                // Refresh node tree

            // Remove item
            $('.item-del a').click(function(e){

                var node_selected = mind.get_selected_node();
                node_selected = node_selected.id;


                // Refresh node tree

            // Click outside to hide menu
            $('html, body').click(function(){
                $('jmnode.selected .node-menu').removeClass('active')


2 – Then we save and generate the application

3 – Then we create an application of the form type of the “Single Registration” type

4 – Within the onApplicationInit event we add the following code

.scFormColorPaleteItem {
    border-color: #000 !important;
    border-width: 0.5px !important;
    margin-bottom: 2px;
.scFormPage {overflow: hidden;}

if(isset($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'], 0, 14) == "www.scriptcase") {
        <style type="text/css">.scFormHeader{display:none!important;}</style>

5 – Within the onScriptInit event the following code

sc_block_display(‘blsettings’, ‘off’);

6 – Finally, within the onLoad event, the following code is added

{chart_mindmap} = '<div id="mindmap" style="width:98%;height:350px;"></div>';

//{bt_upd} = "<a href='javascript:upd_all();' class='scButton_default' style='vertical-align: middle;display:inline-block;'>".{lang_mindmaps_update}."</a>";
//{bt_organize} = "<a href='javascript:layoutAll();' class='scButton_default' style='vertical-align: middle;display:inline-block;'>".{lang_mindmaps_layout}."</a>";

    {mindmap_json} = 0;


// Call javascript function
$langs = {lang_mindmaps_update}.";".{lang_mindmaps_layout}.";".{lang_mindmaps_undo}.";".{lang_mindmaps_redo}.";".{lang_mindmaps_save}.";".{lang_mindmaps_load};

sc_ajax_javascript( 'drawChart', array({mindmap_json}, 'id_sc_field_mindmap_json',$langs) );

7 – We save and run the application

Tutorials in the same category

Integration with WhatsApp

To integrate WhatsApp with ScriptCase, we will be using a specific API called Chat-API, it is a...

Tutorial: Blank Application

In this example a Blank application will be created, using for example jquery code to create an acc...

Using the Paypal and Pagseguro API

1 - We create an application of the grid type 2 - We edit the following fields and create a ...

Send multiple SMS with the sc_send_sms macro

In this example we will be seeing how we can create an application that helps us send multiple mess...

Comment this post