NetTalk Central

Author Topic: Multi-tab problem - SessionValues being replaced  (Read 3474 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Multi-tab problem - SessionValues being replaced
« on: June 03, 2019, 11:06:12 AM »
Hi, Bruce

I have encountered a problem with multi-tab.

With multi-tab on, when you call a form for a new record (an In-Memory table in this case) from the menu everything works fine.  If you call the same form as a url (generated from a script) from another form (a NT memory form) everything works fine, once.  A new GUID is generated for the primary key value; the passed parameters are loaded right; edits can be made; and the record is saved correctly.  If you try to do a second record, the primary GUID is generated and the parameters are loaded properly and everything looks right, except that if you do any edits of the record the primary SessionValue is replaced with the one from the first record.  I originally thought this was caused by the parameters being passed in the URL, but when I added the same parameters to the call from the menu everything worked fine over multiple attempts.

The server log shows that when the target form was called from the memory form script there is a second GET for NewTabID.  The menu GET includes an X-tabID in the cookies but it is missing from the call from the memory form which I assume triggers the GET NewTabID.  Anyway to add the xTabId to the call?

Turning multi-tab off solves the problem but introduces other issues. The server log entries are in the attached file.

Thanks very much

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: Multi-tab problem - SessionValues being replaced
« Reply #1 on: June 03, 2019, 11:39:52 PM »
I'd need an example app to follow through what is happening Casey.

cheers
Bruce

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Multi-tab problem - SessionValues being replaced
« Reply #2 on: June 20, 2019, 12:11:26 PM »
Hi, Bruce

I turned off multi-tab for a time while I dealt with other immediate issues, but I am not comfortable with that as a long or even medium term solution because of the unlikely but consequential data integrity risk.

I have been able to simulate if not duplicate the problem in the modified web server example 1 attached.  When you open the example app it goes straight to the browse, GETting a newTabID as expected.  Click on the Change button and it opens the form (as a page not a pop up) without getting a newTabId, again as expected.  But if you enter the form URL in the address bar of the same browser tab, it will GET a newTabId.  Looks like normal NT controls netweb.js is adding additional information to the header that skips getting newTabID.

Assuming I am right about that, what should I add to the URL generated by my script to bypass GET newTabID?   

The only changes made to the example app are turning multi-tab on and calling the form from the browse as a page not a popup.  The dictionary is unchanged and included just for convenience.

Thanks so much.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: Multi-tab problem - SessionValues being replaced
« Reply #3 on: June 24, 2019, 12:45:08 AM »
Hi Casey,

Thanks for the example. I've made a change for 11.15 which I think will help you;

>> If you call the same form as a url (generated from a script)

When you are creating the URL make sure it contains a data-tabid attribute. For example;

<a href="whatever" data-tabid="x">link</a>

The code will then send the tabid with the request when the link is clicked.

cheers
Bruce

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Multi-tab problem - SessionValues being replaced
« Reply #4 on: June 24, 2019, 09:47:30 PM »
Thanks, Bruce

Unfortunately for me, the scripts I am using are using windows.open rather than <a href to call the new page.  I have fiddled with it but not been able to get the data-tabid passed, so I will wait for 11.15

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: Multi-tab problem - SessionValues being replaced
« Reply #5 on: June 25, 2019, 12:08:42 AM »
perhaps more context on how you are building the links will help me Casey?

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Multi-tab problem - SessionValues being replaced
« Reply #6 on: June 25, 2019, 05:18:48 PM »
Hi, Bruce

Here is an example of the script I am trying to get

<script>
   window.open("http://localhost:88/UpdateBooking?DAT__DateNumber=zvXDBILyhSyBTqSS","_self","data-tabid="'zfs3ogg');
</script>

Works fine until I try to add some form of data-tabid.   Tried with different combinations of double and single quotes for all the components but to no avail.  The best I can get is the page opens but without the tabid.

Any suggestions?  Thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: Multi-tab problem - SessionValues being replaced
« Reply #7 on: June 25, 2019, 09:38:52 PM »
try this (with 11.15);

<script>
   document.cookie = "x-TabID=" + getTabId() + ";";
   window.open("http://localhost:88/UpdateBooking?DAT__DateNumber=zvXDBILyhSyBTqSS","_self");
</script>


with 11.16 and later it will be

<script>
   setTabIdCookie();
   window.open("http://localhost:88/UpdateBooking?DAT__DateNumber=zvXDBILyhSyBTqSS","_self");
</script>

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Multi-tab problem - SessionValues being replaced
« Reply #8 on: June 28, 2019, 11:27:15 AM »
Hi, Bruce

That didn't quite work but it pointed me in the right direction

Using String Theory to concatenate p_web.BrowserTabID into the script:

    document.cookie = "x-TabID=k215kikih";

works perfectly.

Thanks so much.