Session variable not passing between pages

I would imagine you are referring to this –

I went through these steps setting up a browser session utilizing the Submit button.

I tried it several times & didn’t get the value passed through.

So I tried the other instructions that intimated that the Session State management component was quite capable of doing this – just as normal php pages do — set Session go & retrieve it.

I had hopes that after the browser method didn’t work that this spiffy Session State management component was quite capable of doing the deed by being because it was Managing a simple Session value — and holding on to a Session value long enough to get to the next page intact.

If you follow the tutorial everything should be fine. Not sure what you mean by:

But if you don’t see the session value on the other page, then you have set this up wrongly.

Nothing else I can say.

Nothing.

I try to fill in the details

Make voluminous screenshots

Bang my fingers to the bone

Read tutorials

Follow tutorials

I will be up all night on something that has always been utterly simple to achieve.

Probably if you explain what do you actually need to achieve instead of what you have tried to do (which may be wrong in your specific case) would be more helpful.

That I did something Wrong – is WHY I come here

FIRST ASSUMPTION
I offer more details & screenshot than normal

I go step by step

Your screenshots show nothing related to an event which sets a value to the session! So I don’t see how do you set a value to this session to be able to answer what you did wrong.

That makes no sense to me and is quite disrespectful. Wappler is saving you hours, if not weeks, writing and debugging complex code. I’ve outlined what you need to do above. Rather than get annoyed at those offering support why not take five minutes to relax and then follow the instructions…

2 Likes

I’m sorry Dave, I am so frustrated with Wappler

On the contrary, for me, Wappler has added days and days of work and troubleshooting.

If you tell developers that passing a session value from the login page to another page must be done in such a excruciatingly complex fashion BECAUSE of WAPPLER
it would not translate as “saving hours, if not weeks”.

DISRESPECT is from people who say “why not take five minutes to relax and follow the instructions”

I’ve become an expert on so many programs by spending hours and hours of intensive study and trial & error where instructions are missing.

I could recite and handwrite out what the Documentation says in so many places.

Anyway, I am closing up Wappler.

The main problem is javascript ---- tons and tons of it – more than is needed to load a page to do simple, basically Bootstrap pages.

There is no query in your action to select the user. You need to use the security provider ID to filter your user via a simple query as outlined by Teodor. Then you can use the filtered user to set all the sessions you could ever need… There are probably several ways of doing this but this is the method we have used repeatedly with success and no issues.

1 Like

No need to apologise to me. I think we like to blame the tools when infact it is the workmen that are at fault, myself included!

It’s not complex it really is a few clicks.

Seriously? Sorry I just read this while composing my above reply… You apologise and then say I am disrespecting you? Mate I’m not one for grief. I’ll withdraw from this thread before I do disrespect you intentionally. Good luck.

2 Likes

That I am using the Security Provider and it works
at least shows I can follow instructions.

The security provider was used because this is a LOGIN and VALIDATE the USER for Security.

The Login does exactly what I want it to do.

If the user provides incorrect credentials he/she is not admitted to the other pages.

IF I could get that USERNAME posted at this login page it is the KEY to everything else I want to do on the following pages.

When the user is validated this is the next page – validated user authorized page that follows –

Clicking a hyperlink passes the Event ID to the Registration Form page that the user continues filling out and then submits to be stored in the database.

I need to run a Query from the Username posted value on the Login page.

I have always used invisible sessions to pass along value that I can use in a query on the next page.

I want the User information for this particular logged in User to show up on this Event selection page.

I just need to get this one value to show up.

I suspect the “the method we have used repeatedly” has a particular sequence that does not match exactly with the documentation.

In essence, from the time the User successfully LOGGED IN they were Filtered immediately

ONE record was matched to the KEY value included in Username. It ran a query that I created to go and do that action. The action Works fine.

I wish people would really understand “it really is a few clicks” is exactly how I have to get things done in Wappler.

There are no shortcuts, not even for me.

Click, click, click that is how I do it!

When I have things that match the steps in a tutorial I more often than not get pages built with actions that create tables, insert tables, update tables.

It is the FACT that I DO CREATE all kinds of pages in Wappler that gives me the feeling that I am understanding the basic principles.

When i troubleshoot and cannot find a REASON that I can detect because I really don’t know what the Wappler code is always going to look like on the page for each application.

So, I thank people who take a look over my shoulder , so to speak, to see if something jumps to their attention.

So far, people have really been good about using their experience to help.

Right New Year and all that let us start again.

This will get you the user details using the security provider ID (a session is set on successful login automatically you really do not need to set others unless you really want them). You can then use this session ID to filter other DB queries using this ID as the key value…

Once you have matched the user using the above method we can go on to sessions again (if you want to set further sessions like I suggest in my initial reply). In all seriousness once you have done this a single time then next time it really is second nature and so simple. That initial hurdle can be a bastard though, we are all our own worst enemies in this regard. I believe we like to think it should work 100% of the time, but again and again I neglect to RTFM… Teodor can back me up here. The amount of times I have ignored clear and concise instructions is huge, not as many times as I have made myself feel like a complete dickhead though, outweighs the former 10/1. :smiley:

2 Likes

I agree that Dave’s way is the way to actually do this, however just my two cents.

Step 1: You click in the App Structure, on App
Step 2: Click the + button, select State Management area
Step 3: Choose Session Storage Manager
Step 4: Click the Define Session Storage Items in the Session Manager Properties
Step 5: In the popup window, click the + button and name your variable (In your case sessionusername as a number is what you chose)

Up till now, you have created an empty session that holds nothing at all, you have to SET something inside the session variable you created, so if you had a form, with some inputs, and the user just typed in their username, then you have to create an onclick event on the button, or an onsuccess event on a submit button, and inside that event, you will see your empty session, which you can then insert data into from one of the form inputs.

Just having this code

<dmx-session-manager id="session1"></dmx-session-manager>

Is not actually setting any particular value inside the session itself.

I hope that makes more sense.

This is what I had set up on an earlier unsuccessful try

I had set up the Login page submit button to “store” Session items
when the Submit button send the login data for comparison to user identification table.

What I kept looking for was the specific Username field to show up as THE variable that I wanted to Store for retrieval inside the user session on other pages.

I couldn’t find the specific instruction for making sure that I was passing a real posted value.

Ok so now hit the + button while you have Set highlighted
session1.set will then move under browser1.goto
Click on it, in the properties below it, click the name area and a popup list of available variables shoud display, in your case click sessionusername
Now click the lightening bold next to the value field, a list of available bindings should display, you need to choose your form 1 Text Input Username Value.
Now on your next page, you already have the session storage manager in place so you just need to call it anywhere on your page

{{session1.data.sessionusername}}

And that should be it

Thank you very much for taking the time to look at my screenshots, Paul.

I did just that as you showed–

After saving everything in my Log In form.

Then I went to the very next form where I have added the Session Storage Manager

Here is the screen view in the next page form.
I am showing you the Session Manager Properties and the App Structure

I have clicked DEFINE SESSION STORAGE ITEMS
The popup on the left of the image shows what I selected and then saved

This is the resulting page code – I am trying to pass that {{session1.data.sessionusername}} value.
It does not produce a value here or in the top of the page where I had tried binding the value to text in the title of a query.

<dmx-serverconnect id="serverconnect1" url="dmxConnect/api/get_hotels/hotels.php"></dmx-serverconnect>
	<table class="table">
		<div class="table-responsive">
<table class="table table-striped table-bordered table-sm">
  <thead>
    <tr>
      <th>
					Event 
				</th>
      <th>Eventdate</th>
      <th>Eventday</th>
      <th>Eventhotel</th>
      <th>Eventcity</th>
      <th>Eventseats</th>
      <th>Eventqueue</th>
    </tr>
  </thead>
  <tbody is="dmx-repeat" dmx-generator="bs4table" dmx-bind:repeat="serverconnect1.data.query1" id="tableRepeat1">
    <tr>
      <td dmx-text="event_id"></td>
      <td dmx-text="event_date.formatDate(&quot;dd-MM-yyyy&quot;)"></td>
      <td dmx-text="eventday"></td>
      <td><a href="#" dmx-bind:href="mykade_events.php?event={{event_id}}&amp;pharmacy={{session1.data.sessionusername}}">{{eventhotel}}</a></td>

MIRACLE of MIRACLES!

Houston, the Eagle has landed!

One more Save, Save, Refresh loaded code in Wappler

Bingo!!

EVERYTHING forward has hinged on this!

Thank you again for walking through the last steps that I just didn’t see in the documentation.

I’ve always understood that you have to Set the Session Value first and then refer to it in other documents.

What I was lacking was the knowledge of how many steps are necessary with this in Wappler and also that while I can understand logic what I don’t know intuitively is what it LOOKS LIKE in so many settings before you’ve reached the desired goal.

Thank you for opening up this part (so far)
If I can’t pass vaues I am screwed.

So, FINALLY – Thank you, Paul and Teodor!

10 posts were split to a new topic: Insert date information to my database

As a final note on this topic, when working with session variables if you do not get the result you were expecting, try doing force refreshes or closing and reopening the browser window as it may need to clear a session variable before your new one will show.