Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Variable Handling, use Session?

Explorer ,
Aug 28, 2012 Aug 28, 2012

Currently a menu link 'user admin' takes you to list of users which are subscribed to topics.

The clients wants multiple menu links, e.g. 'user admin - topic', so that when they go to the user admin they are only dealing with users subscribed to a specific topic.

So I create these links with a URL variable for 'topicid' and modify the query so that it adds a filter for topicid.

Now I have pagination, edit/delete, add new user, search user controls to work with.

I've started to add hidden inputs to forms, and variables paginations to hold the topicid as I go from one page to another - but I have the fuseactions to contend with, then I'm having doubts as to whether this is the best way to do it... it just doesn't seem elegant.

So I'm pondering the suitability of the session scope, my biggest concern is that the session scope times out. So if the user is sitting on a page for 20 minutes they may get an error if they proceed to the next, so I'll have to add in error handling.

Am I missing a trick? It seems such a basic level thing to do, but I've been working on a legacy app for about 4 years now (it's rusting my brain)- it's always good to get other people's input.

678
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 28, 2012 Aug 28, 2012

Be very careful with session variables.  With tabbed browsers, etc, it is possible for a user to inadvertently change his session variables.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 29, 2012 Aug 29, 2012

Thanks, I've decided maybe I should start using ajax and jquery more. I loathe the lack of code conformity this will cause, but it needs an update!

With ajax and jquery, I won't need to pass around variables, since I'll not leave the page!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 29, 2012 Aug 29, 2012

Thanks, I've decided maybe I should start using ajax and jquery more. I loathe the lack of code conformity this will cause, but it needs an update!

With ajax and jquery, I won't need to pass around variables, since I'll not leave the page!

You're not leaving the page, but you're still hitting the server.  It's not the "page" on the client browser that's causing the session timeouts, it's session inactivity on the server (where the session resides).  So an AJAX call is just as prone to sessions having timed out as any other sort of request.  Indeed the server just see "a request".  It doesn't know or care whether it came from a user's activity on a browser, or some JS making the request via AJAX.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 29, 2012 Aug 29, 2012
LATEST

What I meant was, instead of writing URL variables, hidden inputs or session variables - I will use the Jquery+Ajax approach.

It seems to be a cleaner approach, I will not have to write code to remember variables when paginating or moving between list/edit/add views.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources