NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: rupertvz on February 20, 2012, 02:48:50 AM

Title: Message box
Post by: rupertvz on February 20, 2012, 02:48:50 AM
Hi Guys,

Is it possible to display a dialoque message box to the user from my web-application?
I looked at the message box example, but it requires an additional template.
Can a simple Java message box be called?

Regards
Rupert
Title: Re: Message box
Post by: Matthew on February 20, 2012, 05:12:40 AM
Hi Rupert.

You can simply show message to the user using javascript method for example:

p_web.Script('alert(''xxx'');') where xxx is the string which You want to show to the user.

Regards,
Matthew
Title: Re: Message box
Post by: rupertvz on February 22, 2012, 05:25:45 AM
Thanks Matthew, the popup message is working ...

I'd like to display the message after the user clicked FINISH in the NetWebForm(Wizard)
Source = Memory.

I tried the ValidateAll embed, but crashes the page as soon as the message is called.
I guess it's because the thread is already closed at this point ..?

Is there a spot that I can include p_web.Script('alert(''xxx'');')
.. after the user clicked the FINISH button?
Title: Re: Message box
Post by: Bruce on February 22, 2012, 05:38:56 AM
only in very limited cases (if the wizard is a popup).
Otherwise the Finish button is fetching a new page, so you need to embed the script in that page you are going to.

cheers
Bruce
Title: Re: Message box
Post by: rupertvz on February 22, 2012, 05:49:39 AM
Thanks Bruce,

At the moment I am using some code (for record updates) in the ValidateAll embed of the wizard.
Thereafter I am redirecting to another page ...

Using:  p_web.redirect('http://www.domain.com/page.htm')

I am considering to first call another "blank-message" HTML page on my server, before redirecting to the external URL. 

Is "p_web.redirect" the best way to call a subsequent page on my server from the ValidateAll embed of the wizard?
Title: Re: Message box
Post by: ian.burgess on February 22, 2012, 06:14:36 AM
You can simply show message to the user using javascript method for example:

p_web.Script('alert(''xxx'');') where xxx is the string which You want to show to the user.

What if you want to set values of buttons and perform code based on the user's response in the same way as a standard message() in Clarion?

Ian
Title: Re: Message box
Post by: ccordes on February 22, 2012, 06:29:39 AM
Then you are either coding a javascript prompt box or calling a ntws form page to process the request.
Look here for javascript -> http://www.w3schools.com/js/js_popup.asp (http://www.w3schools.com/js/js_popup.asp)

HTH
Chris
Title: Re: Message box
Post by: kevin plummer on February 22, 2012, 05:21:33 PM
Hi Ian,

although you might be able to achieve what you want via some Javascript, it is one of the probs I had to overcome converting an win app to the web.

Where I would have messagebox warnings to the user (like during posting a batch of invoices) I now just log them and display them as HTML which is actually nicer than the user having to click through a whole bunch of messages. Other messages where the user had a choice of what to do I add some check boxes to the form which they can tick before they click the post button and others I just make the decision for the user.
Title: Re: Message box
Post by: rupertvz on February 22, 2012, 10:37:31 PM
Hi Guys,

With reference to my post above,

I'd like to call a new page inside my app (newpage.htm) from a NetWebForm(Wizard) procedure.
From the ValidateAll embed point.

Is "p_web.redirect" the best way to call a subsequent internal page?
Title: Re: Message box
Post by: Bruce on February 23, 2012, 12:38:10 AM
>> Is "p_web.redirect" the best way to call a subsequent page on my server from the ValidateAll embed of the wizard?

The short answer is no. PostInsert, or PostUpdate would be better.

the longer answer is that you shouldn't be redirecting at all. The Finish button should take you to a known place, set when the form is created. That place (usually a page, or memory form) can be set to make a choice as to what to then display.

cheers
Bruce
Title: Re: Message box
Post by: rupertvz on February 23, 2012, 01:42:53 AM
Thanks Bruce,

But I have quite significant code in the ValidateAll embed, which I can't go without.
As previously discovered, when I let the Wizard go to the "new-page" automatically, it discards the code in ValidateAll.

Any other way?
Title: Re: Message box
Post by: Bruce on February 23, 2012, 05:44:01 AM
ValidateAll runs before PostInsert or PostUpdate. So the code there would still exist.

cheers
Bruce
Title: Re: Message box
Post by: rupertvz on February 23, 2012, 01:18:16 PM
Hi Bruce,

The wizard source is from memory,

Does PostInsert and PostUpdate still apply?
Title: Re: Message box
Post by: kevin plummer on February 23, 2012, 02:48:05 PM
If I'm not sure of something, I add a p_web._trace('bla bla') and see what happens in debugview when I run my app.

Adding a trace to ValidateAll, PostInsert and PostUpdate you will be able to answer your own questions!