Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

A5.executeThisThenThat issue...... not working! :)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    A5.executeThisThenThat issue...... not working! :)

    Alright, hi everyone!

    I am attempting to show a success message first and then a second message that displays a message box with YES/NO options.

    Here is the javascript code:

    Code:
    function showSavedMessage() {
    	A5.executeThisThenThat(showSavedMessage2,askClearToScheduleFlag);
    	
    }
    
    function showSavedMessage2() {
    	A5.msgBox.show('Submit Successful','<div style=\'padding: 20px;\'>Record submitted successfully.</div>','o',function() {
    	
    	});
    	
    }
    
    
    function askClearToScheduleFlag() {
    	
    	A5.msgBox.show('Appointment Scheduled','<div style=\'padding: 20px;\'>Do you want to clear the SCHEDULE APPOINTMENT flag?</div>','yn',function(button){
        if(button == 'yes'){
            // code to save...
            // clearToScheduleFlag
            //{dialog.object}.runAction('clearToScheduleFlag');
            alert('hello');
         } else if(button == 'no'){
            // code to close without saving...
            alert('nope');
         }
    	});
    }
    In the attached example project, I have a button on a UX that just calls the "showSavedMessage()" function, but in my actual project, I have this being called during server-side Save Submitted Data to Tables -> After save succeeded Javascript section. Both are producing the same results.

    Basically, I want the user to see the Submission Successful message first, click OK, then be prompted for with the second box. It seems that the first one never displays, and goes directly to the second box only, prompting for a yes/no.

    I have tried calling the second function for the yes/no box from the first one after the OK is clicked but it seems that it still went directly to the second msgbox.

    Any ideas?!?!?

    Here is a link to a screencast showing how it goes to the yes/no msg box instead of the first one.

    http://screencast.com/t/NjqsGDSLnq

    and an example project is attached:

    thisthenthat_example.zip


    Thank you!!

    #2
    Re: A5.executeThisThenThat issue...... not working! :)

    I think your issue is that A5.msgBox.show is non-blocking. The page will continue to execute after the window is shown. Built-in system popup boxes will block javascript execution - the alert, prompt, whatever the one that starts with a "c" is. There are whole websites dedicated to debating the degree of horribleness that is "alert" and blocking javascript execution.

    Call the second msgBox from the "onClose" function for the first. If you don't "need" to show the second message box in some situations, set a state variable in your first function that you can reference in the last function to determine whether to display the message or not. I wrapped the second call in a setTimeout so the second box would appear. I believe there is a "race condition" - for lack of a better term - of sorts in wanting to show a new A5 message box while an existing one is closing. You can't have 2 open at the same time, for sure. setTimeout should take care of this.

    Code:
    function showSavedMessage() {
    	showSavedMessage2();
    	
    }
    
    function showSavedMessage2() {
    	A5.msgBox.show('Submit Successful','<div style=\'padding: 20px;\'>Record submitted successfully.</div>','o',function(buttons) {
    	    setTimeout(askClearToScheduleFlag,200);
    	});
    	
    }
    
    
    function askClearToScheduleFlag() {
    	
    	A5.msgBox.show('Appointment Scheduled','<div style=\'padding: 20px;\'>Do you want to clear the SCHEDULE APPOINTMENT flag?</div>','yn',function(button){
        if(button == 'yes'){
            // code to save...
            // clearToScheduleFlag
            //{dialog.object}.runAction('clearToScheduleFlag');
            alert('hello');
         } else if(button == 'no'){
            // code to close without saving...
            alert('nope');
         }
    	});
    }
    Alpha Anywhere latest pre-release

    Comment


      #3
      Re: A5.executeThisThenThat issue...... not working! :)

      Ahhhh, thank you Sarah. Was pulling out my nonexistant hair out on this for a while. Seems I have never been able to get the executethisthenthat working..

      Will give this a shot in the morning. Thank you!

      Comment


        #4
        Re: A5.executeThisThenThat issue...... not working! :)

        My experience with this function is zero and I can't find anything on the wiki documenting it, soooooooooooooooooooo -- I'm just assuming that it was built for some other purpose than what you're trying to do with it.
        Alpha Anywhere latest pre-release

        Comment


          #5
          Re: A5.executeThisThenThat issue...... not working! :)

          If you use the Action Javascripting for an event like click, you will see a checkbox to allow you to run commands asynchronously.. so one has to complete before the next. Search the forum for executethisthenthat and you will see about it.

          Thank you!!! :)

          Comment


            #6
            Re: A5.executeThisThenThat issue...... not working! :)

            Originally posted by TheSmitchell View Post
            My experience with this function is zero and I can't find anything on the wiki documenting it, soooooooooooooooooooo -- I'm just assuming that it was built for some other purpose than what you're trying to do with it.
            You can find documentation here. For some unknown reason there is two (maybe more?) separate releasenotes for version 12 (AA). This one has documentation for A5.executeThisThenThat() -function

            Comment


              #7
              Re: A5.executeThisThenThat issue...... not working! :)

              See this video for some more insight http://www.ajaxvideotutorials.com/V1...tExecution.swf
              Frank

              Tell me and I'll forget; show me and I may remember; involve me and I'll understand

              Comment


                #8
                Re: A5.executeThisThenThat issue...... not working! :)

                Ah. It's to prevent callbacks from executing in parallel.
                Alpha Anywhere latest pre-release

                Comment


                  #9
                  Re: A5.executeThisThenThat issue...... not working! :)

                  I used it in an AfterDialogValidate server side event to close the window when data was submitted and posted properly. I needed to make sure that my other Ajax callbacks that posted child information had completed before I closed the dialog:

                  Code:
                      'If we get here everything validated okay and posted to all subsequent improvements so we 
                      'can write the changes back to the calling form, clear the dirty flags on the current component
                      'and then close this form
                      e.javascript = <<%js%
                              function SetFormToClean() {
                                  SetParentData();
                                  setTimeout (function() {
                                  {dialog.object}._setRowState(1,false);
                                  },10);
                              }
                              
                              function CloseThisForm() {
                                  var ele = {dialog.Object}.getPointer('BUTTON_SUBMIT');
                                  {dialog.Object}.closeContainerWindow(ele);
                              }
                              
                              A5.executeThisThenThat(SetFormToClean,CloseThisForm);
                              %js%
                  One of the big "gotchas" that I had to discover was that you don't use quotes around the names of the functions you're calling in A5.executeThisThenThat since what you are actually passing is the objects themselves. Also remember that Javascript is VERY case-sensitive!
                  Brad Weaver, President
                  ComputerAid International
                  Ottawa ON Canada
                  Versailles KY USA
                  www.compuaid.com

                  Comment

                  Working...
                  X