Get a Jumpstart with our Sample Apps
Results 1 to 2 of 2

Thread: JavaScript events embedded in JSON?

  1. #1
    Member
    Real Name
    Scott Binger
    Join Date
    Oct 2011
    Posts
    279

    Default JavaScript events embedded in JSON?

    Mornin' all,

    How would I insert a JavaScript event (say onclick for 'BUTTON_1') within a simple JSON list? In the example below, I just need to execute the on-click event when I click the menu option "Welcome".

    Thanks!


    [ {
    "display": "Welcome",
    "action": "homescreen",
    "icon": "cssIcon=mi mi-Tag-Faces {font-size: 20px; color:#21368a; -xlibrary: materialIcons;}"
    }
    ]

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,162

    Default Re: JavaScript events embedded in JSON?

    If this is a List Control... you don't really do it that way. You put your code into an event in the List Control... e.g. onClick, onSelect. The code tests the action and runs accordingly...

    Code:
    var listAction = this.selectionData[0].action;
    switch(listAction){
    	case 'homescreen':
    		alert('homeScreen');
    		//{dialog.object}.panelSetActive('homeScreen',true);
    		break;
    	case 'action1':
    		alert('action1');
    		//{dialog.object}.panelSetActive('panelCard1',true);
    		break;
    	case 'action2':
    		alert('action2');
    		//{dialog.object}.panelSetActive('panelCard2',true);
    		break;
    }

Similar Threads

  1. passing JSON from Xbasic function to javascript
    By lilmofo812 in forum Mobile & Browser Applications
    Replies: 7
    Last Post: 11-12-2014, 11:12 AM
  2. Looking for details about Action Javascript Open A5W Page Window Javascript Events
    By Davidk in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 04-13-2013, 01:10 AM
  3. Returning JSON Data from remote Server using a Button's JavaScript on Click Event
    By markmoss in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 03-05-2013, 04:26 PM
  4. Replies: 0
    Last Post: 01-23-2012, 07:44 PM
  5. Javascript Row Events vs. System Events
    By Sparticuz in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 07-29-2011, 10:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •