Wappler crowdfunding is now launched! Go to IndieGoGo Wappler Campaign, let's make history!

Working with Sessions

Working with Sessions

Learn how to work with session variables, using App Connect State Management

With this movie we will show you how to work with session variables, using App Connect State Management.

Step by Step

We created a simple form with 3 fields. We'd like to post the form field values to another page on submit. 

Add app connect to this page.

Click add new component (1). Under state management (2), select session storage manager (3).

Define the session variables (1). Right click session storage(2) and add an object. If you need to store a single session value and not multiple form fields, just use the <vtml_break level="2"/> variable. We call this object, form (3). Right click the object (4) and add a variable (5). We add three variables, one for each form field (6-8).

Select the form in the app connect tree (1). And add a dynamic event (2). Select form (3), submit (4).

Click the action picker button (1). Under session storage manager (2), click set(3) and select your session object (4-5).

You will see all of the variables contained in this object. Click the dynamic data picker for the first one (1-5). 

Do this for the rest of the variables selecting the corresponding form fields (1-2). Click select when you're done (3).

Set the form action to point to your second page (1-3).

Before going to page 2, copy the App ID from this page (1). Open page 2 (2).

Add app connect to it.

Add the same app ID as on page 1. This way, the session variables we created on page 1 will be available here also. Otherwise, if you don't use the same ID you will just have to define them again (1). Click add new component(2) and under state management (3), add session storage manager (4). 

Let's bind the session values on the page.

Select the text (1). Click insert binding (2). Under the session manager you will see the object we defined (3-4). Expand the object(5) and select the session variable you want to bind (6-7).

Do the same for the rest of the session variables you want to bind on the page (1-2).

And we're done! Let's preview the results.

We fill the form fields and then we click the submit button to go to the next page. There, you can see the values we've just entered in the form, passed by the session variables and displayed on the page. That's how easy it is to work with sessions using App Connect State Management.

Extensions Covered

Comments

Be the first to write a comment

You must me logged in to write a comment.