Modal Prompts in JS

Michael Houlberg michael at houlbergdevelopment.com
Thu Nov 14 22:03:13 EST 2019


Will,

I faced the same dilemma but once I took all the code “south” of the yes/no messages and put it in another method that is triggered by the result, I decided the resulting code was much cleaner.  It’s not as much work as it seems once you get going on it.  Most of it is just copy and paste.  The only real difference is if you have some local variables involved, you need to turn them into instance variables.

Michael Houlberg
Houlberg Development, LLC

Sent from my iPad

> On Nov 14, 2019, at 3:34 AM, Will Adkin <will.adkin at lineal.co.uk> wrote:
> 
> 
> Hi All,
> 
> I'm missing the Euromnis get-together this year, hope you're all doing well though.
> 
> This is a question about prompts and the Omnis mechanism that runs the JS remote forms. We have about 3000 Yes/No messages in our app as well as a bunch or other prompts that require some form of user choice before continuing - they all run from a single task level object variable that builds and displays a suitable prompt then returns with the user selection. The problem is that this is often in the middle of a method i.e. halfway through processing an invoice, we might warn if the stock is going to drop below a level and ask if they want to continue... for example...
> 
> In the current system this is modal, so Omnis execution pauses at that point in the method stack while we wait for a response. I had hoped to do something similar with JS forms so that we do not have to spilt and rewrite the majority of our core methods, however it does not appear to be that easy.
> 
> I know that the browser on the client runs asynchronously to the Omnis server but was hoping I could work around it by issuing the client command to show a Yes/No prompt and then immediately entering a while loop while we wait for a user response, (in order to keep Omnis executing within our prompt method). When the browser responds with a result it would change the condition of the while loop and then we would then exit with the response. In this way the JS version works the same as the thick client and if there are multiple remote tasks they can time slice on the server and would still be responsive.
> 
> But it does not work. The browser does not display the Yes/No prompt until the Omnis code stops executing on the server, which means we have to exit the method and then start a new stack after the user response, which means we need to rewrite any code that contains a Yes/No. Hmmm.
> 
> The above process may not be the best way to structure code, but it would save us a hell of a lot of time. Is there are a way I can "flush" the current method stack to force Omnis to update the client mid-stack? Perhaps there is another way to simulate a modal response in the world of JS remote forms?
> 
> Any thoughts? All Ideas welcome!
> 
> Best regards
> 
> Will
> 
> 
> 
> [Lineal Software Solutions]        <http://www.lineal.co.uk>
> 
> [Twitter]<https://twitter.com/linealsoftware>  [Facebook] <https://www.facebook.com/linealsoftware?fref=ts&ref=br_tf>   [Google +] <https://plus.google.com/112982815000763473226/about>   [LinkedIn] <https://www.linkedin.com/company/1859834?trk=tyah&trkInfo=clickedVertical%3Acompany%2Cidx%3A1-1-1%2CtarId%3A1437729256906%2Ctas%3Alineal%20s>
> 
> [https://s3.amazonaws.com/htmlsig-assets/spacer.gif]
> 
> Will Adkin  / Software Development Manager
> will at lineal.co.uk<mailto:will at lineal.co.uk>
> 
> Lineal Software Solutions
> 01271 375999
> Commercial House, The StrandBarnstaple, Devon, EX31 1EU
> www.lineal.co.uk<http://www.lineal.co.uk>
> 
> 
> 
> This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Lineal is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-mail. Any opinion and other statement contained in this message and any attachment are solely those of the author and do not necessarily represent those of the company.
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list