Session variable not passing between pages

Hi I am trying to pass a session variable between two pages but unable to.

  1. User Log In
    dmx-on:success="carnival_local.set('user',email.value,{});browser1.alert(carnival_local.data.user);browser1.goto('index.php')">
    On success a session variable is set using a form field value. I can confirm this by having an alert display the new session value.
    47%20PM

However when I move to another page and try to display the same session value in another alert. It is empty

 Session here -  {{carnival_local.data.user}}

Can you explain what I am doing wrong? Note the APP ID for both pages are the same.

Hi, are you using State Management to pass value between the two pages ?

Yes I am : dmxStateManagement

I never saw an answer and I am having the same issue for hours now.

The login page has a value called “username” – which is purely a number such as ‘8998680’ (example)

I have followed the tutorial closely to use the State management component here and then to pick it up on another page by accessing the same State management component.

then on the page that is redirected to on successful login I again apply the State management tool at the top of the APP

No matter how I apply it as a dynamic value for an form input or binding it to a text title … it is not on the page.

Inspector doesn’t show me any errors.

So I am thinking that my Security action used to validate the login username and password against a table before allowing the user to continue is Blocking
setting the same Username value as a session usable later.

Here’s the login page that sets the session for value “sessionusername”

and the action steps for that login page –

Here’s page where I hope to retrieve that “sessionusername” value supposedly stored in the session manager.

How and when do you exactly set the value to this session?

You could add a database query using the security provider ID to filter the user after your security login step. Then create a repeat step after your login action. Select the query used to filter the user as the expression, then pick the fields you wish to repeat from the expression. Then in steps select core action / set session. Pick the field you wish to use for the session value and name it sessionusername. Now when you login successfully it will select the matching users record and set the necessary session to the value you selected. You can then use this session for other filtering uses within your application.

Here’s the sequence in the APP

1 Like

I see nowhere in your screenshots an event which sets a value to your browser session, using the state management component.

I’m going to have to read that a few times!

Basically you’re saying I have to go 7 extra miles for a procedure that should only take a walk down the block.

I set up a query that asked for the values I wanted from another table on the next page after successful login.

The query said to match up the unique record whose Username field matched the Session value of Username established at Login.

But it was the complete failure trying different methods to make the Username – either retrieving the POST value just submitted or getting it as a SESSION value under another name – that has me ground to a standstill.

You mean to Start with on the Login page?

I am sorry but again I don’t understand what are you referring to and what are you trying to do.
Your explanations seem really chaotic and not logical to me - I just can’t get your idea and logic.

It’s explained in the docs how to pass values between the pages using the state management. Check it please:

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