Alpha Video Training
Results 1 to 8 of 8

Thread: Modifying action javascript after converted to text mode if else

  1. #1
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    810

    Default Modifying action javascript after converted to text mode if else

    Trying to add an if, else statement to a on click action javascript crud action after it has been converted to text mode. Then performing an incremental refresh. Also using
    the this, then that sequencing. Can't get this to work, the first part executes if Email_P is null, and I get the alert, but if Email_P has a value the rest of the block does not execute. Can this be done? Not sure how the nesting should be bracketed? Is this a good practice? Is there a better way to approach this?
    var email_check = {dialog.Object}.getValue('Email_P');
    if (email_check == '')
    {
    alert("Customer must have an email to add them to your team, edit the referral an add a valid email");

    }
    else {




    function tempfunction_d441b5ba_22cf_4fd7_b4e8_e24bbb40bdaa() {

    {dialog.object}.ajaxCallback('','','system:CRUDaction','','_xbfunction=CRUDAction_533968d9a516412d90d7947a734df97d');
    }

    function tempfunction_c790a8a4_2cfa_4816_bb8a_0aa378c30d5b() {
    {dialog.object}.refreshListData('VR_REFERRALS',{mode: 'incremental'});






    A5.executeThisThenThat(tempfunction_d441b5ba_22cf_4fd7_b4e8_e24bbb40bdaa,tempfunction_c790a8a4_2cfa_4816_bb8a_0aa378c30d5b);
    }
    }

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

    Default Re: Modifying action javascript after converted to text mode if else

    I would dump the function names and make them more palatable. Then, indent properly and you'll see your error. Your code, properly indented...

    Code:
    var email_check = {dialog.Object}.getValue('Email_P');
    if (email_check == ''){
    	alert("Customer must have an email to add them to your team, edit the referral an add a valid email");
    }else{
    	function call_crudAction() {
    		{dialog.object}.ajaxCallback('','','system:CRUDaction','','_xbfunction=CRUDAction_533968d9a516412d90d7947a734df97d');
    	}
    
    	function call_refreshList() {
    		{dialog.object}.refreshListData('VR_REFERRALS',{mode: 'incremental'});
    		A5.executeThisThenThat(call_crudAction,call_refreshList);
    	}
    }
    You see that the executeThisThenThat is inside the function.

    Corrected code...

    Code:
    var email_check = {dialog.Object}.getValue('Email_P');
    if (email_check == ''){
    	alert("Customer must have an email to add them to your team, edit the referral an add a valid email");
    }else{
    	function call_crudAction() {
    		{dialog.object}.ajaxCallback('','','system:CRUDaction','','_xbfunction=CRUDAction_533968d9a516412d90d7947a734df97d');
    	}
    
    	function call_refreshList() {
    		{dialog.object}.refreshListData('VR_REFERRALS',{mode: 'incremental'});
    	}
    	
    	A5.executeThisThenThat(call_crudAction,call_refreshList);
    }

  3. #3
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    810

    Default Re: Modifying action javascript after converted to text mode if else

    Gotcha,
    Thank you!

  4. #4
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    810

    Default Re: Modifying action javascript after converted to text mode if else

    Corrected the javascript. However couldn't get it to work. So I took a step backwards and just converted the actions to text mode without adding the if/else statement, and, published it, and tried it, no go.
    So it works in action javascript, but not after it is converted to text mode. Is there something else that needs to be done? This is two actions and the this then that statement
    function tempfunction_4c4097c3_4449_42b3_9def_3f642603213a() {

    {dialog.object}.ajaxCallback('','','system:CRUDaction','','_xbfunction=CRUDAction_533968d9a516412d90d7947a734df97d');
    }

    function tempfunction_3188a89e_75d7_48f4_a652_f6d87ea6ca36() {
    {dialog.object}.refreshListData('VR_REFERRALS',{mode: 'incremental'});



    }


    A5.executeThisThenThat(tempfunction_4c4097c3_4449_42b3_9def_3f642603213a,tempfunction_3188a89e_75d7_48f4_a652_f6d87ea6ca36);
    Simplified it and tried just this still no go
    function tempfunction_4c4097c3_4449_42b3_9def_3f642603213a() {

    {dialog.object}.ajaxCallback('','','system:CRUDaction','','_xbfunction=CRUDAction_533968d9a516412d90d7947a734df97d');
    }
    Left the function names as is didn't want to mess with that until I got it working. Using version 3962 build 4772.
    -the button is in the detail view of a list control and I m inserting a record into one of the tables that the list is pulled from it's based on a join, so the list record is altered hence the need for the refresh, for more context.
    Last edited by bob9145; 10-15-2019 at 12:33 PM.

  5. #5
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    810

    Default Re: Modifying action javascript after converted to text mode if else

    this was a miss fire
    Last edited by bob9145; 10-15-2019 at 01:59 PM.

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

    Default Re: Modifying action javascript after converted to text mode if else

    Quote Originally Posted by bob9145 View Post
    this was a miss fire
    Not sure what that means.

  7. #7
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    810

    Default Re: Modifying action javascript after converted to text mode if else

    sorry " this was a misfire" was a reply in error and couldn't delete so I just edited it. Kinda like when you send a text to the wrong girl friend. :)

  8. #8
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    810

    Default Re: Modifying action javascript after converted to text mode if else

    Created a fresh button control and got it working awful touchy. Guess the control was corrupted some how.

Similar Threads

  1. Synchronous Javascript Executions Text Mode
    By joegrun4 in forum Mobile & Browser Applications
    Replies: 5
    Last Post: 10-04-2016, 08:09 PM
  2. Action Javascript Button Text Color Problem
    By Rich Hartnett in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 01-25-2015, 05:13 PM
  3. UX Component - Action Javascript - Delete Record Action - Enhancements
    By dantum in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 05-21-2014, 10:01 AM
  4. Modifying the Toolbar Action Buttons
    By Charles Hoens in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 04-23-2012, 10:49 AM
  5. Memo Field Text Converted Upon Opening
    By forskare in forum Alpha Five Version 7
    Replies: 0
    Last Post: 04-26-2006, 06:36 PM

Bookmarks

Posting Permissions

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