NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: jking on February 04, 2019, 08:35:37 AM

Title: Force form to always open on tab 1
Post by: jking on February 04, 2019, 08:35:37 AM
I would like my form to open on page 1 (tab 0) every time it is opened.  I have tried the following in many embeds without sucess:

loc:tabTo = 0
do ChangeTab

When I first run the app (NT 11.04), the form opens to page 1.  If I go to Page 3 (tab 2)close the form or save, then open another record, it opens on the last tab selected.  Suggestions?

Thanks,

Jeff King
Title: Re: Force form to always open on tab 1
Post by: Robert Iliuta on February 04, 2019, 09:22:46 AM
Hallo Jeff!

Try this:
p_web.SSV('showtab_FormName',0)

put on generate form, late... End Stage Case

Robert
Title: Re: Force form to always open on tab 1
Post by: jking on February 04, 2019, 09:44:29 AM
Robert,

     Thanks for the suggestion, but it did not work for my app.  I think I used the right embed, see attached image. 

     I failed to mention this is a disconnected (PWA) app so I suspect I need to do this in JavaScript.  I have tried some JS code, but have had no success.  Was hoping maybe there was a Clarion code solution.  Any experience with JS and disconnected apps?

Thanks,

Jeff
Title: Re: Force form to always open on tab 1
Post by: Robert Iliuta on February 04, 2019, 10:14:47 AM
>>   I failed to mention this is a disconnected (PWA) app so I suspect I need to do this in JavaScript.

I did not check on disconnected (PWA) app...
Normal web app will work with that code.

>>Any experience with JS and disconnected apps?
Sorry, no.

Robert
Title: Re: Force form to always open on tab 1
Post by: Bruce on February 04, 2019, 10:18:21 PM
>>  I failed to mention this is a disconnected (PWA) app

Here's a tip.
Because PWA's run "on the phone" with no interaction with the server, there's no way for embed code (written in Clarion) to affect the PWA. (*)

(*) Except for code which runs when the _page_ (excluding the data) is created. So widget options etc are still ok, but anything to do with the "data" is not.

I'll check out your example Jeff.

cheers
Bruce
Title: Re: Force form to always open on tab 1
Post by: jking on February 05, 2019, 09:17:47 AM
Bruce,

     Thanks for the tip.  I do have a basic understanding of this, so I tried a few things.  Here are some code snippets I tried in the console of Chrome, that did control the tab:

     $("#tab_updatecoincollection_div").tabs("select", 0);

     $("#tab_updatecoincollection_div").tabs({"active": 2});

     $("#tab_updatecoincollection_div").tabs({active: 0});

     However, where to embed this code in my app is the problem.  Fields on a form have a onChange (JavaScript) entry on the template where I can place JavaScript code.  An image control has an onGenerate entry on the template.  I was not able to find a similar entry for tabs though.  So, I thought I needed to use p_web.Script().  For example:

     p_web.Script('$("#tab_updatecoincollection_div").tabs("select", 0);', 1,0,0)

I'm not sure this is the best way to do this, and the problem is which embed to place this code.  I spent a lot of time trying many embeds, with little or no success.  Maybe we can have more of these JavaScript entries on the templates?  Or, is there an embed where this should be done?

Thanks,

Jeff