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

afterRecordInsert Server-Side Event -- Can't emit to browser??

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

    afterRecordInsert Server-Side Event -- Can't emit to browser??

    Is it not possible to emit JS to the browser from the 'afterRecordInsert' event?

    I was going to use this event for some new records handling.


    ScreenShot_005.jpg


    ScreenShot_006.jpg
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    #2
    Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

    I don't think you do it there. afterDialogValidate can reference rtc.flagRecordWasSaved so that you can return Javascript based on that. Have a look at the notes for afterDialogValidate.

    You also have Client-side Events... After save succeeded Javascript.

    Comment


      #3
      Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

      Originally posted by Davidk View Post
      I don't think you do it there. afterDialogValidate can reference rtc.flagRecordWasSaved so that you can return Javascript based on that. Have a look at the notes for afterDialogValidate.

      You also have Client-side Events... After save succeeded Javascript.
      Thank you, David. I'll take a look. The handling I need would be for new records only. Not sure how I'd detect a new record client-side in the After save succeeded event.
      Mike Brown - Contact Me
      Programmatic Technologies, LLC
      Programmatic-Technologies.com
      Independent Developer & Consultant​​

      Comment


        #4
        Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

        Ok then... instead... use the Client-side Event "After save" AND "Data to pass to client side event". The "e" object gets passed into your client-side function... and you can load up the "e" object with server-side data. E.g.

        After save function: myAfterSave
        Data to pass: __saveType = rtc.primaryTableEditMode

        and the Javascript function would be...

        Code:
        function myAfterSave(e){
        
        	debugger;
        	var saveType = e.__saveType;
        
        }
        where saveType will be "Enter" for an Insert and "Update" for... well... an Update.

        Comment


          #5
          Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

          Oh this is great! Thanks David. This is exactly the type of thing I was looking for.
          Mike Brown - Contact Me
          Programmatic Technologies, LLC
          Programmatic-Technologies.com
          Independent Developer & Consultant​​

          Comment


            #6
            Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

            Originally posted by mikeallenbrown View Post
            Thank you, David. I'll take a look. The handling I need would be for new records only. Not sure how I'd detect a new record client-side in the After save succeeded event.
            will you be using same ux/dialog to insert as well as update? not the usual method as far as i know.
            you will have one ux to insert the data so when that saves it is the new record, is that not correct? or a new functionality is present in version 12 where you can mix those insertion and update on the same ux?

            edit: the example you posted in the first post is expecting a variable not a string, that is why it does not work.
            sorry, noticed you used e.javascript, that should have worked.
            Last edited by GGandhi; March 20, 2017, 08:24 PM.
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            [email protected]
            Skype:[email protected]
            1 914 924 5171

            Comment


              #7
              Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

              This particular UX inserts and updates records.
              Mike Brown - Contact Me
              Programmatic Technologies, LLC
              Programmatic-Technologies.com
              Independent Developer & Consultant​​

              Comment


                #8
                Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                if you add this code right after the save data action script you will see whether is update or insert
                Code:
                if rtc.flagRecordWasSaved then
                        dim v as c
                	v = rtc.primaryTableEditMode
                end if
                e.javascript = "alert('"+ v +"');"
                then you can use the variable v for something else

                edit:
                https://www.screencast.com/t/y5OmIGmXxvxH
                Last edited by GGandhi; March 20, 2017, 09:00 PM.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                  Nice. Thanks Gandhi!
                  Mike Brown - Contact Me
                  Programmatic Technologies, LLC
                  Programmatic-Technologies.com
                  Independent Developer & Consultant​​

                  Comment


                    #10
                    Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                    But... e.javascript is not available in that server-side event function.

                    will you be using same ux/dialog to insert as well as update? not the usual method as far as i know.
                    Not sure I understand... why not? Why would you have 2 Components when 1 will look after Inserts and Updates?

                    Agreed... moving rtc.primaryTableEditMode into afterDialogValidate is much cleaner.

                    You also need to take care of the e.javascript that's already been created... and look after your variable in any case...

                    Code:
                    dim v as c = ""
                    if rtc.flagRecordWasSaved then
                    	v = rtc.primaryTableEditMode
                    end if
                    e.javascript = e.javascript + "alert('"+ v +"');"
                    Last edited by Davidk; March 20, 2017, 09:20 PM.

                    Comment


                      #11
                      Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                      Not sure I understand... why not? Why would you have 2 Components when 1 will look after Inserts and Updates?
                      take a look at my video david, once i realized that mike is just adding another button to do both insert and update, my head became clearer.
                      old age has its problems.

                      about 2 components-
                      i am not in the habit of trusting the users to be diligent in entering the data, give them a chance they will play with your data. if you have one dialog for insert and update, it will show all fields including primary key and the user can enter the primary key and without hitting the button enter new information and they will submit the data. may be you can try in your system and see what happens. even if you were to succeed preventing unauthorized entry of new data, you will find it hard to convince me.
                      my idea is
                      for update i will have the primary key and no other field shown unless they hit the button, so only that record will come out.
                      for insert i won't have the primary id field, it will be hidden. so they cannot enter but auto increment nature will insert the next id.
                      well that is my thinking. you are an expert you know better way to do i am sure.

                      as far as e.javascript
                      you are correct, it is better to append the original one.

                      edit:
                      and look after your variable in any case...
                      i think you are referring to dim v as c = "" assigning default value. while that is a perfect use, in alpha it is not necessary, as far as i know.
                      simple v = "gandhi" will dim a variable v to a character type and assign empty space and then assign value "gandhi" to that variable.
                      dimming and also assigning value is necessary if that variable is going to be used globally or in functions where that value needs to be reset to evaluate to proper value.
                      dimming to a character value in that declaration is all that necessary, again as far as i know.

                      alpha, being an elephant, a very intelligent animal on the planet, knows how to take care of us, i am sure.
                      Last edited by GGandhi; March 21, 2017, 07:36 AM.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      [email protected]
                      Skype:[email protected]
                      1 914 924 5171

                      Comment


                        #12
                        Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                        This is from the notes in afterDialogValidate...

                        In addition, since the Server-side Action will have already set the value of the e.javascript variable, you will want to append your code to e.javascript
                        If you don't do this, then the javascript set up by the server-side action will not get run.

                        i think you are referring to dim v as c = "" assigning default value. while that is a perfect use, in alpha it is not necessary, as far as i know
                        It's not a question of how you create your variable... but rather that if you don't create a variable outside your "if" statement... and the code inside your "if" statement does not run... then the code after your "if" statement, which uses the variable, will fail.
                        Last edited by Davidk; March 21, 2017, 11:09 AM.

                        Comment


                          #13
                          Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                          if the variable is created outside and the if statement fails the variable will be created but will not used just gets thrown away, but if statement succeeds then if the variable is needed and it gets created and used. certain part of the memory is not used.
                          is that not right?
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          [email protected]
                          Skype:[email protected]
                          1 914 924 5171

                          Comment


                            #14
                            Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                            This is from the notes in afterDialogValidate...

                            In addition, since the Server-side Action will have already set the value of the e.javascript variable, you will want to append your code to e.javascript
                            If you don't do this, then the javascript set up by the server-side action will not get run.
                            i have said, you are correct, you don't need to reiterate.
                            thanks for reading

                            gandhi

                            version 11 3381 - 4096
                            mysql backend
                            http://www.alphawebprogramming.blogspot.com
                            [email protected]
                            Skype:[email protected]
                            1 914 924 5171

                            Comment


                              #15
                              Re: afterRecordInsert Server-Side Event -- Can't emit to browser??

                              Originally posted by GGandhi View Post
                              if the variable is created outside and the if statement fails the variable will be created but will not used just gets thrown away, but if statement succeeds then if the variable is needed and it gets created and used. certain part of the memory is not used.
                              is that not right?
                              I'm confused now. All I was pointing out is that your code, the following code, would blow up if the code inside the "if" statement did not run...

                              Code:
                              if rtc.flagRecordWasSaved then
                                      dim v as c
                              	v = rtc.primaryTableEditMode
                              end if
                              e.javascript = "alert('"+ v +"');"
                              Just make sure you create your var outside the "if" statement and you'll be ok.

                              Comment

                              Working...
                              X