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

Javascript and XBasic Help Please

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

    Javascript and XBasic Help Please

    Dialog has a button that I want clicked from the embedded grid.

    Ajax Callback from grid:

    Code:
    function test as c (e as p)
       dim js as C
       js = js + "{grid.Object}.getParentObject().buttonClick('BTNPRICE');" 
       test = a5_run_javascript(js) 
    end function
    What is the correct way of doing this?
    Rapid Development, Training, Support
    http://data2web.network
    903-740-2549

    #2
    Re: Javascript and XBasic Help Please

    Hi Michael

    Here is the simplest example of doing it from an ajax callback:
    function test as c (e as p)
    test = "{grid.Object}.getParentObject().buttonClick('BTNPRICE');"
    end function

    Comment


      #3
      Re: Javascript and XBasic Help Please

      Actually, you would just put this in the inline javascript of the grid event:
      Code:
      {grid.Object}.getParentObject().buttonClick('BTNPRICE');
      Otherwise you're making a trip to the server just to execute client-side Javascript.

      That said, I bet it's not working as is, and that's why you posted it. I'm shooting from the hip here, but I think it'd be more like this:
      Code:
      var myDialog = {grid.Object}.getParentObject();
      myDialog.buttonClick('BTNPRICE');

      Comment


        #4
        Re: Javascript and XBasic Help Please

        Thank you Chris, I was trying to do it from an xbasic function where I have trouble figuring out how to use e.javascript correctly.
        Is e.javascript only to be used as a function return or can it be used as is?

        Function return:
        Code:
        function test as c (e as p)
           .....
           .....
           test = e.javascript = (blah)
        end function
        As-Is:
        Code:
        function test as c (e as p)
           .....
           myvar = e.javascript = (blah)
           .....
        end function
        I'd really like to master this because I can do much with it.
        Rapid Development, Training, Support
        http://data2web.network
        903-740-2549

        Comment


          #5
          Re: Javascript and XBasic Help Please

          Shooting from the hip again, but I think the Dialog AfterValidate (and similar) functions use e.javascript. Xbasic functions are just a string value for the function, e.g.
          Code:
          myFunction as C (e as p)
          'xBasic
          today = date_format(date(),"MM/dd/yy")
          myFunction = "alert('Today is " + today + ".');{grid.Object}.refresh();"
          The grid AfterSubmit etc have an example in the comments with aa. and some kind of array(? not in front of me right now).

          I am never going to defend the documentation in Alpha, but a lot of the basics are right there in the function prototypes for you to use. Or the links around the function, etc. That's how I remember this stuff, too.

          Comment


            #6
            Re: Javascript and XBasic Help Please

            Hi Michael

            In your first example you were using your own xbasic function. In the case of your own function, you basically just set the return value of the function to be the javascript you want executed. So in my first reply posted above, you used the function name test, so we set test to be the javascript we want executed:

            function test as c (e as p)
            test = "{grid.Object}.getParentObject().buttonClick('BTNPRICE');"
            end function

            In the predefined Alpha server-side events we need to return the javascript we want executed a bit differently, so to do that, we use e.javascript. Take for example the afterDialogValidate event, one way to execute some javascript after that event completes would be populate it into e.javascript. For example:
            e.javascript = "alert('test');"

            Comment


              #7
              Re: Javascript and XBasic Help Please

              Thanks Mike, that cleared things up for me.

              If I understand this correctly,
              e.javascript can be used

              1) As a function return in an xbasic function
              2) As a command in Server-Side

              Let's assume that I want to use it as a command inside of an xbasic function, instead of as a return.
              I'm guessing that I would need to call an outside function as in...

              Code:
              function main as c (e as p)
                 .....
                 test(e)
                 .....
              end function
              
              function test as c (e as p)
                 .....
                 .....
                 test = "{grid.Object}.getParentObject().buttonClick('BTNPRICE');" 
              end function
              Rapid Development, Training, Support
              http://data2web.network
              903-740-2549

              Comment


                #8
                Re: Javascript and XBasic Help Please

                I'm just making sure we are clear, don't use e.javascript if you are using your own xbasic function. You just return your javascript into the function name.

                I think I can see what you are trying to achieve now. You want javascript to execute during your xbasic function (rather than at the end) - is that correct? If it is, this probably wouldn't be a good idea, because it wouldn't happen in the order you would be expecting. It is really only intended to have javascript execute at the end of an Xbasic function.

                Comment


                  #9
                  Re: Javascript and XBasic Help Please

                  You were correct, I was hoping to find a way to run javascript from within xbasic because I can keep all of my code together instead of here, there and everywhere.

                  To summarize:
                  e.javascript can be used

                  1) As a function return in an xbasic function
                  2) As a command in Server-Side
                  Rapid Development, Training, Support
                  http://data2web.network
                  903-740-2549

                  Comment


                    #10
                    Re: Javascript and XBasic Help Please

                    Originally posted by mvaughn View Post
                    To summarize:
                    e.javascript can be used

                    1) As a function return in an xbasic function
                    Originally posted by michaeldarby View Post
                    I'm just making sure we are clear, don't use e.javascript if you are using your own xbasic function. You just return your javascript into the function name.
                    ....
                    It is really only intended to have javascript execute at the end of an Xbasic function.
                    Peter
                    AlphaBase Solutions, LLC

                    [email protected]
                    https://www.alphabasesolutions.com


                    Comment


                      #11
                      Re: Javascript and XBasic Help Please

                      I am having trouble with the same/similar issue.
                      I have a button that lets the user upload a file. In the Server-side Events: After Upload, I have it call an xbasic function (xb_save_file_to_ticket_upload_table) to put the data from the uploaded file into the appropriate table. At the end of the xbasic function, I am trying to call a javascript function to do some screen stuff.
                      I have tried:
                      e.javascript = "js_load_tickets();" -- this gave me an error message -- js_load_tickets is undefined (I know it is there)

                      e.javascript = "{dialog.object}.runAction('run_js_load_tickets');" (after creating an action script called run_js_load_tickets that calls the js_load_tickets function) -- this gave me an error messag -- DLG1_DlgObj is undefined

                      xb_save_file_to_ticket_upload_table = "js_load_tickets();" --- this does not give me an error, but it does not call the js_load_tickets function either.

                      At this point, the js_load_tickets only contains an alert to let my know I 'arrived'

                      function js_load_tickets(){
                      alert('in js_load_tickets');
                      }

                      what am I doing wrong?

                      Comment


                        #12
                        Re: Javascript and XBasic Help Please

                        Anita, you can follow this example on how to call javascript from xbasic:

                        XBASIC:
                        Code:
                        function my_xbasic as c (e as p)
                           ...
                           your code
                           ...
                           my_xbasic = "closeme();"
                        end function
                        JAVASCRIPT:
                        Code:
                        function closeme(){
                           {dialog.Object}.resetForm(false); 
                           {dialog.Object}.closeContainerWindow(this);
                        }

                        OR COMBINING THE TWO:
                        Code:
                        function my_xbasic as c (e as p)
                           ...
                           your code
                           ...
                           my_xbasic = "{dialog.Object}.resetForm(false);{dialog.Object}.closeContainerWindow(this);"
                        end function
                        I hope that helps :)
                        Rapid Development, Training, Support
                        http://data2web.network
                        903-740-2549

                        Comment


                          #13
                          Re: Javascript and XBasic Help Please

                          Michael,

                          If you looked at the examples I gave, I tried that approach:

                          function xb_save_file_to_ticket_upload_table as v (e as p)



                          xb_save_file_to_ticket_upload_table = "js_load_tickets();"

                          function js_load_tickets(){
                          alert('in js_load_tickets');
                          }

                          Comment


                            #14
                            Re: Javascript and XBasic Help Please

                            Michael,

                            If you looked at the examples I gave, I tried that approach:

                            XBASIC FUNCTION:
                            function xb_save_file_to_ticket_upload_table as v (e as p)

                            ' code
                            'more code


                            xb_save_file_to_ticket_upload_table = "js_load_tickets();"

                            end function

                            JAVASCRIPT FUNCTION:
                            function js_load_tickets(){
                            alert('in js_load_tickets');
                            }

                            It does not give an error, but it also does not ppup the alert message.


                            Edit Post Reply Reply With Quote .

                            --------------------------------------------------------------------------------

                            Comment


                              #15
                              Re: Javascript and XBasic Help Please

                              Anita, your error is in the function declaration. Xbasic requires this exact syntax:
                              function function_name as C (e as p)

                              Change the "v" to a "c" and you'll be all set.
                              Rapid Development, Training, Support
                              http://data2web.network
                              903-740-2549

                              Comment

                              Working...
                              X