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

    #16
    Re: Javascript and XBasic Help Please

    Changed "v" to "c" - made no difference. Still not getting to javascript function. Does rest of code in xbasic just fine (which it did before), but no popup message.

    Comment


      #17
      Re: Javascript and XBasic Help Please

      P.S. I put in a debug to make sure it was getting to the function return --- xb_save_file_to_ticket_upload_table = "js_load_tickets();" --- and it is. But no alert popup.

      Comment


        #18
        Re: Javascript and XBasic Help Please

        Is your javascript located in Javascript Functions?
        Rapid Development, Training, Support
        http://data2web.network
        903-740-2549

        Comment


          #19
          Re: Javascript and XBasic Help Please

          Yes. it it the first function. I have several others.

          Comment


            #20
            Re: Javascript and XBasic Help Please

            If all else fails, lol, try this:

            Code:
            function xb_save_file_to_ticket_upload_table as c (e as p)
            
            	' code
            	'more code
            
            	dim jtext as c =<<%txt%
            	alert('hello');
            	%txt%
            
            	xb_save_file_to_ticket_upload_table = jtext
            end function
            After you get your hello, just put your javascript there as in:

            dim jtext as c =<<%txt%
            var x = {dialog.Object}.getvalue('MYFIELD1');
            {dialog.Object}.setvalue(''MYFIELD2',x);
            line 3;
            line 4;
            etc...;
            %txt%

            =<<%txt% is a wrapper for your javascript.
            end with %txt% on its own line
            Rapid Development, Training, Support
            http://data2web.network
            903-740-2549

            Comment


              #21
              Re: Javascript and XBasic Help Please

              These are now the very last lines in the xbasic function:
              debug(1)
              dim ls_js as c = <<%txt%
              alert('trying javascript');
              %txt%


              xb_save_file_to_ticket_upload_table = ls_js
              end function

              I am still getting no alert popup. I am beggining to hate this program (Alpha 5)!

              Comment


                #22
                Re: Javascript and XBasic Help Please

                the = and the << must touch as in my example above.

                You're almost there!
                Rapid Development, Training, Support
                http://data2web.network
                903-740-2549

                Comment


                  #23
                  Re: Javascript and XBasic Help Please

                  code now reads:
                  dim ls_js as c =<<%txt%
                  alert('trying javascript');
                  %txt%


                  xb_save_file_to_ticket_upload_table = ls_js

                  end function

                  STILL no alert popup. the debug shows that ls_js is getting the javascript text, but then nothing happens.

                  Comment


                    #24
                    Re: Javascript and XBasic Help Please

                    Originally posted by Anita Headley View Post
                    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 don't think you can return js from the AfterUpload event. There's nothing in the "help" comments for that event. Usually when there's no mention of how to send javascript back, you can't do it. I tried all the methods I know of in Alpha and couldn't make any of them work (e.javascript, functioname =, and e.rtc.A_AjaxResponses.) Maybe try specifying your function in the Client-side after upload event instead. If you have data that needs calculating/etc server side in order for your function to work, you can do an ajaxCallback and get the data - which you can store in session or e.rtc variables server-side in your existing xbasic function.
                    Alpha Anywhere latest pre-release

                    Comment


                      #25
                      Re: Javascript and XBasic Help Please

                      This is what I mean about Alpha5. This is the function prototype for the Server-side Event:

                      function xb_save_file_to_ticket_upload_table as v (e as p)
                      'This function is called after the file(s) selected in the Upload Files dialog have been uploaded to the server.
                      'The function is responsible for processing each uploaded file.

                      'Request - The Request object. Includes Request.Variables, which should be used instead of the older e.rv construct
                      'Session - The Session object. Should be used instead of the older e.session construct

                      'The passed in 'e' object contains these properties

                      'e.fileCount - the number of files that were uploaded
                      'e.fileArray - a property array with one entry for each uploaded file
                      'e.uploadProperties - Contains multiple sub-properties for all of the properties set in the Action builder.
                      'e.tmpl - pointer to the UX Component definition
                      'e.rtc - a pointer variable that contains run-time calculations
                      'e.__si - state information

                      'Each entry in the e.fileArray array has these propeties (where 'i' is between 1 and e.fileCount):
                      'e.fileArray[i].file.characterSet - character set of the uploaded file
                      'e.fileArray[i].file.contentType - MIME type (e.g. 'application/octet-stream')
                      'e.fileArray[i].data - data that was uploaded. This will either be binary data or text data. Check the .file.dataType property
                      'e.fileArray[i].fileName - filename of the file on the client machine
                      'e.fileArray[i].encoding - For text files, specifies the encoding type
                      'e.fileArray[i].file.dataType = Either 'text' or 'binary'

                      'If you want to send any Javascript back to the browser to execute after this event has completed, you can set this property:
                      'e.javascript
                      'EXTREMELY IMPORTANT - The Javascript that is sent back to the browser is executed in the context of the IFrame that contains the File Select window.
                      'Therefore, in order for the Javascript you send back to invoke methods of the Dialog object, you must prefix all methods with 'window.parent'.
                      'For example: window.parent.{dialog.object}.setValue('CONTROL1','VALUE1');

                      'You can set e.abort = .t. to abort the operation. If you set e.abort to .t. then you can set e.errorText to the text you want to display to the user.

                      end function


                      I even tried

                      dim ls_js as c =<<%txt%
                      window.parent.alert('trying javascript');
                      %txt%

                      xb_save_file_to_ticket_upload_table = ls_js

                      end function

                      still with no results.

                      I would gladly call it from a client-side AfterUpload event if there was one. I don't find it in the Client-Side Events at all.

                      Comment


                        #26
                        Re: Javascript and XBasic Help Please

                        Originally posted by Anita Headley View Post
                        This is what I mean about Alpha5. This is the function prototype for the Server-side Event:

                        function xb_save_file_to_ticket_upload_table as v (e as p)
                        'This function is called after the file(s) selected in the Upload Files dialog have been uploaded to the server.
                        'The function is responsible for processing each uploaded file.

                        'Request - The Request object. Includes Request.Variables, which should be used instead of the older e.rv construct
                        'Session - The Session object. Should be used instead of the older e.session construct

                        'The passed in 'e' object contains these properties

                        'e.fileCount - the number of files that were uploaded
                        'e.fileArray - a property array with one entry for each uploaded file
                        'e.uploadProperties - Contains multiple sub-properties for all of the properties set in the Action builder.
                        'e.tmpl - pointer to the UX Component definition
                        'e.rtc - a pointer variable that contains run-time calculations
                        'e.__si - state information

                        'Each entry in the e.fileArray array has these propeties (where 'i' is between 1 and e.fileCount):
                        'e.fileArray[i].file.characterSet - character set of the uploaded file
                        'e.fileArray[i].file.contentType - MIME type (e.g. 'application/octet-stream')
                        'e.fileArray[i].data - data that was uploaded. This will either be binary data or text data. Check the .file.dataType property
                        'e.fileArray[i].fileName - filename of the file on the client machine
                        'e.fileArray[i].encoding - For text files, specifies the encoding type
                        'e.fileArray[i].file.dataType = Either 'text' or 'binary'

                        'If you want to send any Javascript back to the browser to execute after this event has completed, you can set this property:
                        'e.javascript
                        'EXTREMELY IMPORTANT - The Javascript that is sent back to the browser is executed in the context of the IFrame that contains the File Select window.
                        'Therefore, in order for the Javascript you send back to invoke methods of the Dialog object, you must prefix all methods with 'window.parent'.
                        'For example: window.parent.{dialog.object}.setValue('CONTROL1','VALUE1');

                        'You can set e.abort = .t. to abort the operation. If you set e.abort to .t. then you can set e.errorText to the text you want to display to the user.

                        end function


                        I even tried

                        dim ls_js as c =<<%txt%
                        window.parent.alert('trying javascript');
                        %txt%

                        xb_save_file_to_ticket_upload_table = ls_js

                        end function

                        still with no results.

                        I would gladly call it from a client-side AfterUpload event if there was one. I don't find it in the Client-Side Events at all.
                        The comments for yours are way different from mine. I can't return js. But I have a client side event. Your comments say to use e.javascript. So set e.javascript = ls_js. If setting e.javascript in xb_save_file_to_ticket_upload_table doesn't work, then that comment is bunk and I would email a bug report to Alpha since the claim right there is that you should be using e.javascript. However, in your earlier post, you saw an error message that {dialog.object} was not defined (because it needed to be prefixed with window.parent, probably.) So I am apt to believe that this will work.

                        You don't need to prefix the alert function with window.parent. Just any references to {dialog.object}. In fact, prefixing alert might cause an error...
                        Last edited by TheSmitchell; 10-31-2013, 05:59 PM.
                        Alpha Anywhere latest pre-release

                        Comment


                          #27
                          Re: Javascript and XBasic Help Please

                          I have tried the alert both ways and neither worked. I then tried calling the javascript function with the window.parent prefix:

                          e.javascript = "window.parent.js_load_tickets();"

                          AND IT WORKED. finally! It gives me the alert popup. Now to see if it will let me do any other javascript commands.

                          Comment


                            #28
                            Re: Javascript and XBasic Help Please

                            Originally posted by Anita Headley View Post
                            I have tried the alert both ways and neither worked. I then tried calling the javascript function with the window.parent prefix:

                            e.javascript = "window.parent.js_load_tickets();"

                            AND IT WORKED. finally! It gives me the alert popup. Now to see if it will let me do any other javascript commands.
                            Great! Good luck.
                            Alpha Anywhere latest pre-release

                            Comment

                            Working...
                            X