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

calling UserName from parent login component UX issue

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

    calling UserName from parent login component UX issue

    Hello! Was wondering if anyone could help me with an issue I'm currently having. Basically I have a main component, nested as an embedded object inside a login UX component. I am calling the UserName field and writing that to a control inside the child UX, using:
    Code:
    var po = {dialog.Object}.getParentObject();
    var userId = po.getValue('UserName');
    //alert(userId);
    {dialog.object}.setValue('userId',userId)
    that works, but only once! I am guessing that because the lookup is going to an unbound field, there's really nothing left to look up after the event fires initially. What would be a good way for the child UX component to be able to call that original stored variable until logout?

    #2
    Re: calling UserName from parent login component UX issue

    What events are you using?

    Comment


      #3
      Re: calling UserName from parent login component UX issue

      Well hello again there David. onRenderComplete, and onPanelActivate. I put that similar code into a button hoping to be able to test that way as well.

      Comment


        #4
        Re: calling UserName from parent login component UX issue

        So your code is in both onRenderComplete and onPanelActivate?

        Comment


          #5
          Re: calling UserName from parent login component UX issue

          Yes, identical code in both places. If you submit a record, or refresh the page it seems to lose the username. It will only work once after logging out and back in again.

          Comment


            #6
            Re: calling UserName from parent login component UX issue

            Sounds like a logic flow problem. You're logging into a UX and during the login process you're setting an unbound control named 'userName', in the parent UX, with a user name value.

            Then you do something which activates the panel that houses your embedded component. Code in the child UX grabs the parent, grabs 'userName' and sets the child control 'usedId'.

            Then you're refreshing... what? The parent UX? How? Browser refresh? And... because of your active session... you're still logged in... but your 'userName' control is now empty... because you refreshed the UX and have not filled it with anything... because you don't need to login... which is needed to trigger setting the 'userName' control.

            So... I'm guessing this is a Web app... not a Mobile app... because you're refreshing stuff. There's probably a bit of other info missing as well. You mention submit a record... where... child UX? It's data bound? Are you refreshing the page after you submit? Why would a Parent control get cleared when a child UX submits.

            I think you need to be very specific about what gets cleared... where... and after what action.

            I'd guess that the Parent control gets cleared after a refresh. It's unbound and you're not setting it again because you're already logged in.

            The child control gets clears after a submit because it's a bound field... and you're probably setting up for a new record (although you haven't said) and you're not doing anything to reset that control.

            Comment


              #7
              Re: calling UserName from parent login component UX issue

              Sorry yes, I was trying to ask a general question without giving all the details. The login component I am using is the template provided in the software. The embedded UX is for technicians to submit a record into the database. I am not refreshing the parent UX, I was testing within my laptop browser because I do envision these guys trying to also enter records using the same application, even though it's designed for mobile. If I have to craft an a5w page for computer use, and the other one be dedicated for mobile only that's fine too. It's just that the same thing will happen regardless if I am using the browser on a phone, or the browser on a laptop, at least after submitting the record. At no point am I refreshing the parent UX, I was referring to the browser refresh.

              So yes, is the issue more that I need to preserve that userId after the record gets submitted. It sets up for a new record. Maybe something needs to live in the submit button or elsewhere to grab what is living in that control and set to a variable for use in the next record?

              Comment


                #8
                Re: calling UserName from parent login component UX issue

                That sounds like a session variable in ondialog initialize would work perfectly, if the username is coming from the security tables alpha already has a built in function to get that, and you can set that as the DEFAULT value which would work every time there is a new record. If that's what your after every maybe someone will point out the function, if not I will post it when I get home I can't remember stuff off the top of my head. You wouldn't even need a session variable then.
                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


                  #9
                  Re: calling UserName from parent login component UX issue

                  Since you're working with a web page... not mobile... and you're refreshing, then you should use a session var. Plus... make like easy for yourself and use state variables as well.

                  In your parent UX, in the server side onLogin event, set a session var to your username...

                  Code:
                  session.userId = userName (whatever var your username is in)
                  Then, in your embedded UX, onDialogInitialize event...

                  Code:
                  e._state.userId = session.userId
                  Then... in any javascript you create in the child... you can do this...

                  Code:
                  var myUserId = {dialog.Object}.stateInfo['userId'];
                  alert(myUserId);
                  In your embedded UserId control you could set it's default value to...

                  Code:
                  =session.userId
                  or in javascript...

                  Code:
                  {dialog.Object}.setValue('userId',{dialog.Object}.stateInfo['userId']);
                  There are other ways to "publish" session vars so that the client side of a UX will see them... but I'm not so crazy about that. State vars are much easier to deal with.

                  Comment


                    #10
                    Re: calling UserName from parent login component UX issue

                    Wow yes, thank you. This looks like exactly what I was after. I was reading about session variables but that post made things much clearer than the documentation I had been reading. I'm slowly accumulating more knowledge as I work with this, as well as some of the other data driven apps I'm making for our company. It's a bit late on the weekend for me to play with this tonight, but I'll implement and post back to let you guys know how it went. I had another issue trying to use a lookup function to actually write the PK from the tech table into the form, but I solved that with an ON INSERT trigger if/else on the SQL side of things.

                    I was indeed confused regarding the *mobile* term, I was thinking in terms of it rendering on the mobile device. Obviously that's still just a web page. Maybe one day when this is all working properly I'll explore making a proper mobile application using the same base.

                    Comment


                      #11
                      Re: calling UserName from parent login component UX issue

                      Originally posted by CharlesParker View Post
                      That sounds like a session variable in ondialog initialize would work perfectly, if the username is coming from the security tables alpha already has a built in function to get that, and you can set that as the DEFAULT value which would work every time there is a new record. If that's what your after every maybe someone will point out the function, if not I will post it when I get home I can't remember stuff off the top of my head. You wouldn't even need a session variable then.
                      I would be interested to see this also, yes. Mainly to see how it compares to David's way of attacking it. Yes, all the usernames will be living in the security tables.

                      Comment


                        #12
                        Re: calling UserName from parent login component UX issue

                        put
                        =a5ws_getcurrentuser()
                        as the default value for the field. It will always be the logged in username for a NEW record.
                        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: calling UserName from parent login component UX issue

                          Originally posted by CharlesParker View Post
                          put
                          =a5ws_getcurrentuser()
                          as the default value for the field. It will always be the logged in username for a NEW record.
                          This worked just fine! Thank both of you guys for helping me out. I now have a pretty basic yet functional application. I do need to do some reporting and have that automatically filter based on the userId, but I will tinker and attempt to learn that without too much hand holding. I am going to watch this video many times, as it seems like it's chock full of the session variable information I need to keep going.

                          Comment

                          Working...
                          X