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

Page-to-Page Variables

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

    Page-to-Page Variables

    I have two UX components, each on a separate page. I have a text box field who's value I want to pass over to another field on the other page when I click a button, which also goes to the page by using:
    window.location = 'Quotes.a5w';.

    Each of these fields are linked to different tables. I am having one heck of a time determining what type of variable to use and, after hours of testing, cannot get ANY type of variable to work. This must be very simple and I must not be using the proper syntax. I have been able to use local variables and session variables all coded into a button to transfer the value from one text box to another between two panels, but both panels were within the same UX Component.

    The reason why I have them separated on two pages is because One component is a UX that links my Employee Table to to the RegisteredUsers table, and the other is a Contact table which has all of the employee's info. For example, the text box FirstName on the Contact Details form (populated by a contact list on a previous panel) contains the value I want to place in the EmpFirstName text box on the EmployeeUsers form.

    Also, being on two different pages, my working and live previews do not work so I have to publish to the server each time in order to test.

    I have the session variable in the Contacts UX properties setup as:

    SESSION.FIRSTNAME = ""

    I reference it as:

    {dialog.object}._vars.SESSION.FIRSTNAME

    But I do not know how to get that value into the EmpFirstName text box.

    I have tried doing so with a default value of:

    ={dialog.object}._vars.SESSION.FIRSTNAME

    and even in the server's onDialogInitialize, but AA shows an error so I am am sure I am not using the right syntax there.

    Am I even close? What am I missing?

    I have asked so many questions already I hope I am not exceeding a limit here, but I always check the forum, videos and documentation before I post. I am sure I am not searching for the right stuff or even understanding what I am finding, but nonetheless, I am trying.

    EVERY response is appreciated and does not fall on deaf ears, but it may take a few responses in order for it to get to the brain.

    #2
    Re: Page-to-Page Variables

    Here's a link dump for you. My brain is foggy, so I might not be understanding what you're talking about ---

    If passing the variables from one page to the next is one-way, eg you start on page foo.a5w and pass data to bar.a5w and never go back to foo.a5w again, you can use Page variables (http://wiki.alphasoftware.com/~alpha...m+a+V10+Grid):

    Code:
    window.location = 'Quotes.a5w?myId='+myId+'&myVal='+myVal;
    Page variables are passed using ?name=value&name2=value2 and so on and so forth --- this is how you'd pass a variable to .html page as well.

    You can reference page variables sever-side (http://wiki.alphasoftware.com/~alphafiv/Page+Variables) and client-side (http://wiki.alphasoftware.com/~alpha...ide+expression).

    If you are switching back & fourth between the two pages, you'll probably want to use session variables.

    The session variables would have to be set server-side with an ajaxCallback (http://wiki.alphasoftware.com/~alpha...ack%20Method):
    Code:
    // The call back javascript:
    {dialog.object}.ajaxCallback('','','setMySessionVars','','');
    
    // the xbasic function you called:
    function setMySessionVars as c (e as p)
      session.myVar1 = "var1"
      session.myVar2 = "var2"
    end function
    Accessing these session variables server-side would just be referencing "session.myVar1", "session.myVar2", etc.

    If you set the session variables for use in your next page, I recommend returning the javascript code to do the redirect as part of the ajax callback:

    Code:
    function setMySessionVars as c (e as p)
      session.myVar1 = "var1"
      session.myVar2 = "var2"
    
      setMySessionVars = "window.location = 'Quotes.a5w';"
    end function
    This way you guarantee they're set before your navigate to the new page. (You could also probably use response.redirect here instead of window.location: http://wiki.alphasoftware.com/~alpha...EDIRECT+Method)

    Accessing them client-side would require that you Publish your session variables in your UX component: http://wiki.alphasoftware.com/~alpha...lient+Side+V11

    To reference a session variable as the default value for a UX Control, the syntax is "=session.myVar1".

    Alternatively, you could move all the components from both pages into a single UX with a few panels or something. Then you can just access the values in both directly without much effort.

    Laaaaaaaaaaaaater,

    *zzz*
    Alpha Anywhere latest pre-release

    Comment


      #3
      Re: Page-to-Page Variables

      Thank you so much for that reply.

      Based on what you have shown me and what I know I will have to do in the future, I think session variables and ajax callbacks are the way to go, but where do global variables fit into all of this?
      Yes, I would love to just combine the two UX components, but I was under the impression that there are certain onDialogInitialize and other events that are specifically required for the loading and saving of web security values that need to be in a separate component. Right not I am just using the events that came with the UX template SecurityFramework-CreateNewUserAccount_And_AddUserInformationToRelatedTable.
      Last edited by BCJack; 01-06-2015, 12:51 PM.

      Comment


        #4
        Re: Page-to-Page Variables

        Originally posted by BCJack View Post
        Thank you so much for that reply.

        Based on what you have shown me and what I know I will have to do in the future, I think session variables and ajax callbacks are the way to go, but where do global variables fit into all of this?
        Yes, I would love to just combine the two UX components, but I was under the impression that there are certain onDialogInitialize and other events that are specifically required for the loading and saving of web security values that need to be in a separate component. Right not I am just using the events that came with the UX template SecurityFramework-CreateNewUserAccount_And_AddUserInformationToRelatedTable.
        "Global Variables" as in javascript or "Global Variables" as in xbasic?
        Alpha Anywhere latest pre-release

        Comment


          #5
          Re: Page-to-Page Variables

          You know, I have no clue. I have read your post well over ten times now, including every link, and I am still just not getting this.

          I am beginning to question if variables are even the way to go.
          Textbox A value --> Textbox B, with A and B being on two separate dialog components on two different pages, triggered by a button.

          This is not that complicated, I am sure, yet this is a whole new language to me, technically multiple new languages, but hey, I was lost at one.

          Comment


            #6
            Re: Page-to-Page Variables

            Just so I understand the workflow:

            1. User launches Page A containing Textbox A
            2. User does stuff on Page A
            3. User clicks a button on Page A that opens Page B that contains Textbox B
            4. Textbox B is populated with data from Textbox A
            5. User does stuff on Page B
            6. User is done with Page B

            What happens next?
            Alpha Anywhere latest pre-release

            Comment


              #7
              Re: Page-to-Page Variables

              Originally posted by TheSmitchell View Post
              Just so I understand the workflow:

              1. User launches Page A containing Textbox A
              2. User does stuff on Page A
              3. User clicks a button on Page A that opens Page B that contains Textbox B
              4. Textbox B is populated with data from Textbox A
              5. User does stuff on Page B
              6. User is done with Page B

              What happens next?
              Next: User saves page B and is taken back to page A, NEVER to see page B again. NEVER. EVER. They will see (and even edit that info again later, but not with page B (NewUser), they will do that with Page C (EditUser)

              Would be nice to have a logical checkbox on page A be given a positive value once the page B submission goes thru, but that is just flair. Other than that checkbox, no data is sent back to Page A from Page B.

              Just for reference, Page A has two panels, one with a list and one with details populated from the list (text box A is on the details panel).

              Comment


                #8
                Re: Page-to-Page Variables

                Originally posted by BCJack View Post
                Next: User saves page B and is taken back to page A, NEVER to see page B again. NEVER. EVER. They will see (and even edit that info again later, but not with page B (NewUser), they will do that with Page C (EditUser)

                Would be nice to have a logical checkbox on page A be given a positive value once the page B submission goes thru, but that is just flair. Other than that checkbox, no data is sent back to Page A from Page B.

                Just for reference, Page A has two panels, one with a list and one with details populated from the list (text box A is on the details panel).
                Then your issue is very simple!

                You need to pass data one-way, to page B from page A.

                Another question for you:

                Does Page B do anything besides display the UX? EG: are you just using Page B as a container to display a UX component?
                Alpha Anywhere latest pre-release

                Comment


                  #9
                  Re: Page-to-Page Variables

                  NewUser.zip


                  Yes. It is the dialog that links my employee table with my websecurityusers SQL table. It is attached and is made from the the UX template:
                  SecurityFramework-CreateNewUserAccount_And_AddUserInformationToRelatedTable

                  So Page B is essentially a new users form that will only be seen once. iIn fact, that checkbox I talked about will be used to disable the button from even being functional once the contact is marked as an employee.
                  Since the new user is already in our contacts system, we have most of his info and just need to pass it over. once it gets there I can do cool stuff like make the default username his first name initial and full last name, I just need to get it over there first.

                  Comment


                    #10
                    Re: Page-to-Page Variables

                    In this case, you can just open the UX Component directly using the Action Javascript: Open a UX Component straight from the button (you don't need to embed it in an .a5w page.)

                    You can pass data to the UX using arguments. Which, I would recommend. Reference your arguments as the default value in your UX fields using "=:nameofargument"

                    I think Video G_V12--18 "Opening a UX from a Button on a Grid and Passing Information Into the UX" is probably what you're looking for.

                    The approach is pretty much the same for opening a UX from a UX.
                    Alpha Anywhere latest pre-release

                    Comment


                      #11
                      Re: Page-to-Page Variables

                      Yeah, I remember that video. I think there is something similar to that with pages as well, only I am building this for to be viewed by mobile devises I did not think it would look that good. Nonetheless, I think you are right by directing me down the simple path, and I am going to give that a shot and I'll let you know. I also bought a few e-books from Liberty Manuals, so I am hoping that I will better understand the proper usage of XBasic and JS.

                      Comment


                        #12
                        Re: Page-to-Page Variables

                        Originally posted by BCJack View Post
                        Yeah, I remember that video. I think there is something similar to that with pages as well, only I am building this for to be viewed by mobile devises I did not think it would look that good. Nonetheless, I think you are right by directing me down the simple path, and I am going to give that a shot and I'll let you know. I also bought a few e-books from Liberty Manuals, so I am hoping that I will better understand the proper usage of XBasic and JS.
                        If you wanted to stick with the page, then using page variables is probably best (eg, "mypage.a5w?nameofvariable=a". In the server-side onDialogInitialize or onSynchronize for the UX, I believe you can access the page variables in the request object:

                        Code:
                        if (variable_exists("request.variables.nameofvariable")) then
                          ' code here
                          dim nameofvariable as c = request.variables.nameofvariable
                        end if
                        http://www.alphasoftware.com/alphafo...+page+variable
                        Alpha Anywhere latest pre-release

                        Comment


                          #13
                          Re: Page-to-Page Variables

                          Ok I told you I would give you an update, and here it is:

                          I ended up using page variables as you suggested. When it finally worked I had to jump around a little in joy, but then I tried using multiple page variables and I got a bit of an issue. The first variable transfers over sucessfully, but the other ones do not.

                          2015-01-12 19_05_59-UX.png

                          Code in button OnClick
                          Code:
                          var FN1 = {dialog.object}.getValue('FirstName');
                          var FN2 = FN1.substring(0,1);
                          
                          var LN1 = {dialog.object}.getValue('LastName');
                          var LN2 = LN1.substring(0);
                          
                          var UN = FN2.concat(LN2);
                          var UN = UN.toLowerCase();
                          
                          var P = {dialog.object}.getValue('MobilePhone');
                          var E = {dialog.object}.getValue('EmailAddress');
                          
                          var A1 = {dialog.object}.getValue('Address1:1');
                          var A2 = {dialog.object}.getValue('Address2:1');
                          var C = {dialog.object}.getValue('City:1');
                          var S = {dialog.object}.getValue('State:1');
                          var Z = {dialog.object}.getValue('ZipCode:1');
                          
                          {dialog.object}.setValue('DEBUG',UN);
                          
                          window.location = 'NewEmp.a5w?UN='+UN+'&FN1='+FN1+'&LN1='+LN1+'&P='+P+'&E='+E+'&A1='+A1+'&A2='+A2+'&C='+C+'&S='+S+'&Z='+Z+'';
                          Code on redirect Page's server-side onDialogInitialize Event:
                          Code:
                          if (variable_exists("request.variables.UN")) then
                            dim UN as c = request.variables.UN
                          end if
                          if (variable_exists("request.variables.FN1")) then
                            dim FN1 as c = request.variables.FN1
                          end if
                          if (variable_exists("request.variables.LN1")) then
                            dim LN1 as c = request.variables.LN1
                          end if
                          if (variable_exists("request.variables.P")) then
                            dim P as c = request.variables.P
                          end if
                          if (variable_exists("request.variables.E")) then
                            dim E as c = request.variables.E
                          end if
                          if (variable_exists("request.variables.A1")) then
                            dim A1 as c = request.variables.A1
                          end if
                          if (variable_exists("request.variables.A2")) then
                            dim A2 as c = request.variables.A2
                          end if
                          if (variable_exists("request.variables.C")) then
                            dim C as c = request.variables.C
                          end if
                          if (variable_exists("request.variables.S")) then
                            dim S as c = request.variables.S
                          end if
                          if (variable_exists("request.variables.Z")) then
                            dim Z as c = request.variables.Z
                          end if
                          Code in one of the Textbox's deafult Value property:
                          Code:
                          =pageVariable.P
                          Where am I going wrong here?

                          Comment


                            #14
                            Re: Page-to-Page Variables

                            It's incredibly impossible to tell what's going here. So I'm going to start with asking about your URL.
                            • What was the URL you got?
                            • Did it contain any characters that needed to be URL encoded?
                            Alpha Anywhere latest pre-release

                            Comment


                              #15
                              Re: Page-to-Page Variables

                              Originally posted by TheSmitchell View Post
                              It's incredibly impossible to tell what's going here. So I'm going to start with asking about your URL.
                              • What was the URL you got?
                              • Did it contain any characters that needed to be URL encoded?
                              Yeah, I tend to make things like that,even when there is no need unfortunately.

                              The URL returned was:
                              http://belcovo.com/NewEmp.a5w?UN=aorozco

                              I am not sure about the URL-encoded characters, but if you mean passwords or anything like that, then no.

                              Which is just the first variable.

                              The code on the button was formatting the first and last name into a username, then making variables off of certain fields.
                              What you see in the onDialogInitialize code was the same code repeated 10 times DIM the page variables.

                              Comment

                              Working...
                              X