Lost Session Username -- now trying new Technique to get same

Earlier I had a problem with the Login page losing its Security Restrictions (generic term)

After following the suggestion to remove the Browser action and its click attributes or events (whatever)

I got back the Security Login WORKING at my Online test site.
Proper Username and Password accessed the next page.

But lost the Username variable which I have worked on for DAYS.

The Browser Component removal killed the method used to pass along the logged in Username

After trying to repeat the steps that got me to a working solution before I have repeatedly failed to find the crucial path again.

So I went here – and tried THIS

It is not explicitly stated at the top that it is a method that only works in one situation — when the Login page upon successful entry stays in place but now displays User information through data binding as the tutorial explains.

I am completely exhausted — two steps forward – 3 steps backward.

I don’t know how to skin this cat anymore.

What particular part of that documentation is not working? I use that method all the time and it works like a charm.

Yes, if this is all applied on the same page that is also used for the LOG IN

In the meantime SUCCESS

I went into all my saves earlier and replaced such key elements as

<dmx-session-manager id="session1"></dmx-session-manager>
	<div is="dmx-browser" id="browser1" dmx-on:click="session1.set('sessionusername',session1.data.sessionusername,{});browser1.goto('select_hotel_form.php')"></div>

and reset the button that had been affected

<button class="btn btn-primary" type="submit" dmx-on:click="session1.set('sessionusername',username.value,{})">Log in</button>

I now have LIFTOFF again – Secure Login AND a session value essential to filtering data on the other pages.

I realized that some things in Wappler are fixed much more rapidly by modified the actual code instead of relying on App view to move or re-install Components.

I see that most all of the Visual Components applied with App Structure simply make some lines of javascript.

Looking at the code solves thing much faster for me.

I see the sequence of things in the code view – telling me far more than strictly relying on Symbols as ADD Components.

This realization that modifying the code & comparing past editions which I save after every incremental step will help me resolve problems much quicker now.

Can you send me the code for the next page too.

The browser on click was not what made any change.

Those onclicks would have done nothing anyway.

Here’s the page that needed the Username variable to show up

It is then used to make sure that the URL parameters associate the User Event registration with the pharmacy id (by account #)

this URL then passes pertinent data to the Form itself on the next page for actual $_Post Registration data.

THANK ALL FOR THEIR KIND AND PATIENT FOREBEARANCE

— page code –

<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Kade Hotels Select Form</title>
	<script src="dmxAppConnect/dmxAppConnect.js"></script>
	<script src="js/jquery-3.3.1.slim.min.js"></script>
	<link rel="stylesheet" href="fontawesome4/css/font-awesome.min.css">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<link rel="stylesheet" href="bootstrap/4/cosmo/bootstrap.min.css">
	<link rel="stylesheet" href="dmxAppConnect/dmxBootstrap4TableGenerator/dmxBootstrap4TableGenerator.css">
	<script src="dmxAppConnect/dmxDataTraversal/dmxDataTraversal.js" defer=""></script>
	<script src="dmxAppConnect/dmxFormatter/dmxFormatter.js" defer=""></script>
<script src="dmxAppConnect/dmxStateManagement/dmxStateManagement.js" defer=""></script>
<script src="dmxAppConnect/dmxBrowser/dmxBrowser.js" defer=""></script>
</head>
<body id="show_hotels" is="dmx-app">
<dmx-serverconnect id="userdetails" url="dmxConnect/api/users/userdetails.php"></dmx-serverconnect>
<dmx-session-manager id="session1"></dmx-session-manager>
<img src="assets/images/logo-drkade.jpg" width="283" height="88" alt="Dr. Kade" id="drkade" class="img-fluid img-thumbnail">
<dmx-serverconnect id="connectionkade" url="dmxConnect/api/get_hotels/hotels.php"></dmx-serverconnect>
<main>
<div class="d-flex text-center flex-column">
  <p></p>
<p><b>Herzlich Willkommen, liebe Apotheke </b></p>
<p><b>melden Sie sich für eine der folgenden
Veranstaltungen an:</b></p>
</div>
</main>
	<table class="table w-75">
		<table class="table table-striped table-bordered table-sm text-center mw-100">
  <thead>
    <tr>
      <th class="w-auto text-center">{{session1.data.usernamesesson}}Event</th>
      <th class="text-left w-25">Eventhotel</th>
      <th class="text-center">Eventdate</th>
      <th class="text-center">Eventday</th>
    
      <th>Eventcity</th>
    </tr>
  </thead>
  <tbody is="dmx-repeat" dmx-generator="bs4table" dmx-bind:repeat="connectionkade.data.queryhotels" id="tableRepeat1">
    <tr>
      <td dmx-text="event_id" class="text-center"></td>
      <td dmx-text="event_date.formatDate(&quot;dd-MM-yyyy&quot;)" class="text-center"></td>
      <td dmx-text="eventday" class="text-center"></td>
      <td><a href="#" dmx-bind:href="mykade_events.php?event={{event_id}}&amp;pharmacyid={{session1.data.sessionusername}}&amp;eventhotel={{eventhotel}}&amp;eventdate={{eventhotel}}&amp;eventdate={{event_date.formatDate(&quot;dd-MM-yyyy&quot;)}}&amp;eventcity={{eventcity}}">{{eventhotel}}</a></td>
      <td dmx-text="eventcity"></td>
    </tr>
  </tbody>
</table>
<div class="content">
<main class="text-center font-weight-bolder w-75">
<div class="table-responsive">
  <table class="table">
    <thead>
      <tr>
        <th scope="col"></th>
        <th scope="col"><p>Hinweis: Sie können insgesamt 3 Kollegen anmelden und 2
  weitere auf die Warteliste schreiben. Wir melden uns so weitere auf die Warteliste schreiben. Wir melden uns so schnell wie möglich bei Ihnen, ob Sie einen festen Platz bekommen.</p></th>
        <th scope="col"></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th class="table-white" scope="row"></th>
        <td></td>
        <td class="table-white" scope="row"></td>
        <td></td>
      </tr>
      <tr>
        <th scope="row"></th>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </tbody>
  </table>
</div>
</main>
</div>
	</table>
<script src="bootstrap/4/js/bootstrap.min.js"></script>
<script src="bootstrap/4/js/popper.min.js"></script>
</body>
</html>

Ok so first, go to the login page, click the Session Storage Manager, click Define Session Storage Items, make sure under sessionStorage you have sessionusername as a number then replace the body tag of your code with the following

<body id="Dr Kade login" is="dmx-app">
    <dmx-session-manager id="session1"></dmx-session-manager>
    <div is="dmx-browser" id="browser1"></div>

    <div class="container wappler-block pt-3 pb-3">
        <div class="row">
            <div class="col-12 col-xl-4 offset-xl-4 text-center bg-light p-5 col-md-8 offset-md-2">
                <img class="wappler-type-user mb-4 img-fluid rounded-0" width="200" height="62" src="assets/images/logo-drkade.jpg">
                <div class="contentArea">
                    <p class="font-weight-bolder text-info"><b>„Untenrum“ gut beraten</b><span is="dmx-typed"></span></p>
                </div>
                <form id="form1" method="post" is="dmx-serverconnect-form" action="dmxConnect/api/users/login.php" dmx-on:success="session1.set('sessionusername',username.value,{});browser1.goto('select_hotel_form.php')">
                    <div class="form-group" id="kade_login">
                        <label for="username">Username</label>
                        <input type="number" class="form-control" id="username" name="username" placeholder="Enter Your Username">
                    </div>
                    <div class="form-group" id="kade_login1">
                        <label for="password">Password</label>
                        <input type="number" class="form-control" id="password" name="password" placeholder="Enter Your Password">
                    </div>
                    <button class="btn btn-primary" type="submit">Log in</button>
                </form>
            </div>
        </div>
    </div>

    <script src="bootstrap/4/js/popper.min.js"></script>
    <script src="bootstrap/4/js/bootstrap.min.js"></script>
</body>

Next on your second page, first click the Session Storage Manager, click Define Session Storage Items, make sure under sessionStorage you have sessionusername as a number then replace the body tag of your code with the following.

The reason I am asking you to double check this is because I found a reference in your code to usernamesession and not sessionusername

<body id="show_hotels" is="dmx-app">
    <dmx-serverconnect id="userdetails" url="dmxConnect/api/users/userdetails.php"></dmx-serverconnect>
    <dmx-session-manager id="session1"></dmx-session-manager>
    <img src="assets/images/logo-drkade.jpg" width="283" height="88" alt="Dr. Kade" id="drkade" class="img-fluid img-thumbnail">
    <dmx-serverconnect id="connectionkade" url="dmxConnect/api/get_hotels/hotels.php"></dmx-serverconnect>
    <main>
        <div class="d-flex text-center flex-column">
            <p>&nbsp:</p>
            <p><b>Herzlich Willkommen, liebe Apotheke </b></p>
            <p><b>melden Sie sich für eine der folgenden Veranstaltungen an:</b></p>
        </div>
    </main>
    
    <table class="table table-striped table-bordered table-sm text-center w-100">
        <thead>
            <tr>
                <th class="w-auto text-center">{{session1.data.sessionusername}}Event</th>
                <th class="text-left w-25">Eventhotel</th>
                <th class="text-center">Eventdate</th>
                <th class="text-center">Eventday</th>
                <th>Eventcity</th>
            </tr>
        </thead>
        <tbody is="dmx-repeat" dmx-generator="bs4table" dmx-bind:repeat="connectionkade.data.queryhotels" id="tableRepeat1">
            <tr>
                <td dmx-text="event_id" class="text-center"></td>
                <td dmx-text="event_date.formatDate(&quot;dd-MM-yyyy&quot;)" class="text-center"></td>
                <td dmx-text="eventday" class="text-center"></td>
                <td>
                    <a href="#" dmx-bind:href="mykade_events.php?event={{event_id}}&amp;pharmacyid={{session1.data.sessionusername}}&amp;eventhotel={{eventhotel}}&amp;eventdate={{eventhotel}}&amp;eventdate={{event_date.formatDate(&quot;dd-MM-yyyy&quot;)}}&amp;eventcity={{eventcity}}">{{eventhotel}}</a>
                </td>
                <td dmx-text="eventcity"></td>
            </tr>
        </tbody>
    </table>

    <div class="content">
        <main class="text-center font-weight-bolder w-75">
            <div class="table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th scope="col"></th>
                            <th scope="col">
                                <p>Hinweis: Sie können insgesamt 3 Kollegen anmelden und 2 weitere auf die Warteliste schreiben. Wir melden uns so weitere auf die Warteliste schreiben. Wir melden uns so schnell wie möglich bei Ihnen, ob Sie einen festen Platz bekommen.</p>
                            </th>
                            <th scope="col"></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <th scope="row"></th>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <th scope="row"></th>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </main>
    </div>

    <script src="bootstrap/4/js/bootstrap.min.js"></script>
    <script src="bootstrap/4/js/popper.min.js"></script>
</body>

If something does not work right away, please make sure both files are saved and you have refreshed a few times, or rather close the browser window and reopen, to make sure the previous sessions have been cleared.
If still something wrong, tell me before trying to fix rather so I can check please.

The only thing I was unsure of was a class on your first table of mw-100, I think it is possibly meant to be just w-100 but dont know if you have a custom style for that, so left it alone.

Paul, you are amazing!

It must be the beautiful family and South African weather that keeps you moving on!

Thank you so much for taking such patient time with me!

Best wishes for you and yours!

Habitual Africa travellers I’ve known for years have invited me to go with them in the coming year.

We may meet over something other than a keyboard . .

1 Like

I have tried various combinations of username aliases & that code will reflect whatever frenzied thing I was trying that minute.:confused:

I figured that was what may have happened, haha, it’s all good we all been there.

Lets hope things go a little smoother from here. I did not actually make all that many changes to be honest.
I removed all the onclick events on the browser component
I removed all onclick events on your submit button
I made sure your browser goto and your session set was on the forms success

On the next page, I really just made sure it was sessionusername, and a little clean up of the table code, which is still not 100% correct to be honest, but at least the extra table open and close tags are gone, although your last table on that page only has 3 columns and the next 2 rows have 4, so you need to check that, tables should have an equal amount of columns per row unless you are spanning over columns which you are not, so just check that when you use it.

1 Like