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

Session variables in mobile login ux not being set

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

    Session variables in mobile login ux not being set

    I've created a mobile login page using the security framework login component mobile app which is one of the new UX templates.

    As per video UX_V12-66 I've embedded my main mobile app ux component in the login template. So far so good.

    I have declared and set session variables in my mobile login a5 page (index.a5w).

    After successful login my main mobile app is displayed. I have text fields that display these session variables on the UX by using the default value property eg the logged in user name.

    So here is the problem.

    The session variables aren't being set in time, they are empty. After login if I refresh the main page of my app the session variable are displayed correctly. I gather this is because my main UX is embedded in the login UX.

    Any ideas?

    #2
    Re: Session variables in mobile login ux not being set

    Why not separate the components? In your login component you can use this code in the onLogin server-side event...

    Code:
    dim session.variable_1 as c
    
    session.variable_1 = "some value"
    
    e.url = "Your_Main_Page.a5w"
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    Comment


      #3
      Re: Session variables in mobile login ux not being set

      I don't have exactly the same scenario (I'm using the property that allows a UX component to have a login component in it). I'm using the server side onLogin event to trigger the session variables however if I haven't loaded the app in a log time (read cached memory of my mobile browser has been overwritten) or for the first time and I log in the session variables won't be set, but if I log out and log back in the session variables are set (or if I do a page reload after the first login then they are then set), any reason why they aren't set on the first time?

      Comment


        #4
        Re: Session variables in mobile login ux not being set

        Richard... I think there's some confusion somewhere. Your UX has Integrated Login. The UX, by itself, is taking care of login and user verification, etc. I don't think you should have a login a5w page... it's not required. Small point, but I believe it's video UX_V12--65.

        To Richard and Josh... I'm a bit hesitant, depending on the flow and process of the app, to rely on session variables. Depending on how you have things set up, session variables can expire. Is that what you want? Also, depending on where and when you set a session variable on the server side, and when and where you need to access that session variable on the client side... it may not be there yet. This is rarely an issue with Web apps because most of the time pages are being loaded and reloaded. With Mobile, you may not be loading or re-loading beyond the initial startup. Embedded Objects can be loaded, but the main UX isn't re-loaded.

        You should have a look at State variables because they are easily accessible server and client side. They may follow the same availability of session vars, however... I'm not sure about this.

        Further, depending on the data you want to store in a variable, you should also look at dialog namespace variables, local storage, and, if using PhoneGap Build, device file storage. How long do you want that data to hang around?
        Last edited by Davidk; 12-01-2015, 10:19 PM.

        Comment


          #5
          Re: Session variables in mobile login ux not being set

          Our typical flow is always through a login page that goes to a login processing page which goes to an app launcher and then either loads a mobile or desktop site. In doing some other outside custom work I came across the ability to put login options right in the component which meant I didn't have to go mess with the other side of the application building I've done (i.e. trying to decide which mobile app to load in the app launcher based on a bunch of variables). I've always used session variables as default values and in this case need a session variable for a default value of adding a record to a list control using a detail view.

          I was going to try to use location.reload(false) as a way to reload the component fast from cache (which the session variables are there afterward) if the session variable I'm needing isn't found but unfortunately if a user doesn't realize the application is reloading (because they don't recognize their individual device's way of showing them a page is still loading like the spinning icon on the status bar of an iPhone) then they may start trying to use the app and boom it reloads. I love the idea of using the integrated login component but if session variables can't be set it seems almost useless.

          Now I will say I've never used State variables so that is something I need to look into. The variable I need is actually set to a window variable but I'm not sure how to use a window variable as a default in the default value box of a control which really this is what I need the session variable for. If there is another way to accomplish this that is easier than how I am doing it (i.e. trying to use session variables that aren't being set the first time through), I'm all ears!

          Thanks for the feedback!

          Comment


            #6
            Re: Session variables in mobile login ux not being set

            Josh, where is it that you want, or are, setting the session variable that you then need to use as a default value of a control? And... this is a Web Mobile app... is that right? Not a PhoneGap Build Mobile app. Also... where is the control needing the default value? In a PanelCard? In an Embedded Object in a PanelCard?

            Comment


              #7
              Re: Session variables in mobile login ux not being set

              Mobile web app

              Session variables being set in server side onlogin event

              The user moves through a couple of list controls to get to a log where they input some data, I want to tie this data to the user by saving the user ID (which I would normally use a session variable for as the default value).

              All of the controls exist in a single component to make it easier to add offline functionality in the future since it'll never be required to open other components or load embedded ones.

              Comment


                #8
                Re: Session variables in mobile login ux not being set

                Ok... now that I know you're working with List controls... is the log data the detail data of a List control?

                And... what User ID? The User Id (User Name) you used to log in with?
                Last edited by Davidk; 12-02-2015, 01:07 AM.

                Comment


                  #9
                  Re: Session variables in mobile login ux not being set

                  That's correct! My normal way of dealing with new list detail records is using session variables (which if I was loading this app after the login processing page wouldn't be an issue). Right now I'm just setting the value of the control in the detail view to a hidden control that holds the value I need which is set as soon as the component loads. Obviously this works fine but the session variables are useful else where (i.e. as argument values for lists) so in the future I would still like to solve this issue.

                  Comment


                    #10
                    Re: Session variables in mobile login ux not being set

                    But the List control filtering is also dependent upon the "render" properties of that List. If the List control is filtered on a session var... and the List is rendered with the component is rendered then that List is not filtered. If the List is in a PanelCard and the List is set to render when visible... then you're ok for the session var filter.

                    Since you're working with a List control Detail View, you could do this...

                    In your Server-side onLogin event return some Javascript in the e.javascript property... setting a state variable on the client-side.

                    Code:
                    e.javascript = "{dialog.object}.setStateInfo({myvar1: '" + myUserId + "'});"
                    Then, in the List Control, Fields tab, in the field were you want to set a default value... in the Default value Javascript property...

                    Code:
                    return {dialog.object}.stateInfo['myvar1'];
                    Here you're picking up the state variable you set when you returned from the server onLogin.

                    It's a little cleaner than using an extra control... specially if you want to set more than one default.

                    Comment


                      #11
                      Re: Session variables in mobile login ux not being set

                      Definitely like this as a cleaner option than using an extra control (in this case that extra control isn't going away because I have other stuff tied to it and just don't want to deal with cleaning that up right now), but at least moving forward I will have this code as an option so THANK YOU DavidK!

                      Comment


                        #12
                        Re: Session variables in mobile login ux not being set

                        I have a similar issue but I am not using a list control. I have a component with integrated login, which appears to be working however my session variables session.coid which works when I login in through my website perfectly.
                        I took a component, made a copy and added the login controls, uploaded it to phonegap and installed it on my android. I login and I realize that my userid is not showing and subsequent ajax callbacks give me a 403 forbidden - insufficent privledges error.
                        I also noticed that one of my text fields should be showing my userid (session.coid) but it is not, however I am able to "login" if I use incorrect credentials the app does a full reload and kicks me off so I know I am "logging in" with credentials that are working.
                        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                        Comment


                          #13
                          Re: Session variables in mobile login ux not being set

                          As mentioned above its because the session doesn't exist yet so the variables aren't actually set, I tested this myself by logging in using an integrated login and the refreshing my mobile browser at which point I didn't have to login again yet all my session variables were then there. At this point I think we are just going to have to wait for a fix from alpha on fixing the timing issue, may want to try using state variables like DavidK showed above.

                          Comment


                            #14
                            Re: Session variables in mobile login ux not being set

                            For hat its worth - I asked this Question to Selwyn, and be replied
                            Would using these session variables in the initial UX in PhoneGap mobile app expire or is it OK to use them.

                            Example:

                            function afterDialogValidate as v (e as p)

                            session.__protected__clientsideDateFormat = "dd/MM/yyyy&&0h:0m AM"
                            session.UserID = "101"
                            Session.OrganizationID = "101"
                            session.RemoteIP = Request.Remote_Addr
                            session.ThisComponent = e.tmpl.componentFilename

                            end function
                            Reply

                            i don't understand the question at all.

                            the initial ux in a phonegap app is loaded without ever having to contact the alpha server. there does not even have to be an alpha server for the app to load.

                            so when a phonegap app is loaded, there is no server session. the server session is not created until such time as the user makes their first callback to the alpha server.
                            As a result I just don't use session variables, don't need them.

                            Pete
                            Insanity: doing the same thing over and over again and expecting different results.
                            Albert Einstein, (attributed)
                            US (German-born) physicist (1879 - 1955)

                            Comment


                              #15
                              Re: Session variables in mobile login ux not being set

                              OK,
                              Soooo, that means that the login button needs to do something to actually contact the server? Pretty sure it needs to if it's going to log anyone in using the security system.
                              At that point, I guess I need to do SOMETHING to RELOAD my UX to set the session variables...am I right?

                              Can anyone tell me how a phone gap app is supposed to work in regards to session variables and Alpha ?
                              I normally load them when the UX loads, but that obviously does NOT work since the theres no "ajax callback?"
                              So whats a guy to do?

                              I have never used "state" variables, is that the only way?
                              NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                              Comment

                              Working...
                              X