NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: osquiabro on October 05, 2019, 06:28:35 AM

Title: CASE MESSAGE on NT
Post by: osquiabro on October 05, 2019, 06:28:35 AM
is possible create a case message popup like clarion desktop ?? like this :

CASE MESSAGE('Are you sure you want to Change Zip Code? etc..

thanks
Title: Re: CASE MESSAGE on NT
Post by: Bruce on October 09, 2019, 02:28:22 AM
Hi Osa,

yes, but the context matters. Remember the web page is always moving forward.
So it's probably not going to "work" the way you expect - there's no procedure "waiting" on the server for the user to enter input.

So in order to answer this question better I would need to know a lot more about your context. Where you are, what you are doing, and what you are hoping to do with this message, etc.

cheers
Bruce

Title: Re: CASE MESSAGE on NT
Post by: osquiabro on October 09, 2019, 08:18:29 AM
is simple i have a Zip Code field and need a popup message before change the value of the field
Title: Re: CASE MESSAGE on NT
Post by: Bruce on October 09, 2019, 10:06:43 PM
You can have a popup message - alerting the user to some detail, when the field is changed.
But in that context it would be a message, not a decision (ie not a yes/no question).

Tell me more about the message you are intending to display, and what you then expect the user to do, and then what you want to do based on that...

cheers
Bruce
Title: Re: CASE MESSAGE on NT
Post by: urayoan on October 10, 2019, 05:12:46 AM
Hello Bruce,

I think osquiabro is looking for confirmation message, similar when in a browse the user is gonna delete a record. But in this case, alter or change the record.
Title: Re: CASE MESSAGE on NT
Post by: osquiabro on October 10, 2019, 05:43:29 AM
Exactly urayoan, but for more specific this is a code that run in desktop program and needed a similar code with NT

CASE MESSAGE('Are you sure you want to Change Zip Code?, This Change Delivery Charge.','Alert',ICON:Question,+Button:Yes+Button:No,,1)
            OF Button:Yes
                PUT(BillofLadings)
                History::Bil3:Record  :=: Bil3:RECORD
                SQL{prop:sql} ='select BillofladingId, isnull(ChargeId,0) as ChargeId, PaymentType,0 as ChargeTypeId, ChargeDescription from billofladingcharges where billofladingid= '&Bil3:BillofLadingId & ' AND ChargeDescription = <39>'& 'DELIVERY<39>'
                   
                LOOP
                    NEXT(SQL)
                    IF ERRORCODE() THEN BREAK.
                    CASE Bil3:PaymentZone
                    OF 'C'
                        Shipper{prop:sql} = 'CALL BolChargesByCharge('&Bil3:BillofLadingId &','&chr(39)&CLIP(SQL:C3)&CHR(39)&','&Bil3:CustomerId&','& 0 &','&CLIP(SQL:C2) & ',0)'                               
                        BREAK
                    OF 'P'
                        Shipper{prop:sql} = 'CALL BolChargesByCharge('&Bil3:BillofLadingId &','&chr(39)&CLIP(SQL:C3)&CHR(39)&','&Bil3:ShipperId&','& 0& ','&CLIP(SQL:C2) & ',0)'                                 
                        BREAK
                    OF 'T'
                        Shipper{prop:sql} = 'CALL BolChargesByCharge('&Bil3:BillofLadingId &','&chr(39)&CLIP(SQL:C3)&CHR(39)&','&Bil3:PartyId&','& 0 &','&CLIP(SQL:C2) & ',0)'                                 
                        BREAK
                    END                       
                END
                Charges.Load
                Charges.Reset(1)
            OF Button:No
                Bil3:ShipToZipCode = History::Bil3:Record.Bil3:ShipToZipCode
                Bil3:ShipToCity    = History::Bil3:Record.Bil3:ShipToCity
                Bil3:ShipToState   = History::Bil3:Record.Bil3:ShipToState
                SELECT(?Bil3:ShipToZipCode)
                ThisWindow.Reset(1)
            END
        END
Title: Re: CASE MESSAGE on NT
Post by: osquiabro on November 06, 2019, 09:07:09 AM
this is possible with NT or not?
Title: Re: CASE MESSAGE on NT
Post by: bshields on November 06, 2019, 03:06:24 PM
Hi Osquiabro,

Totally possible.

Create Memory Form and format it so it can ask your question (this could easily be generic like message).

Call it as a popup at the correct time.

Record its response somewhere (like session variable).

Back when your previous screen gains focus after the popup closes, check the session variable.

Perform necessary actions.

Regards
Bill
Title: Re: CASE MESSAGE on NT
Post by: osquiabro on November 06, 2019, 05:17:11 PM
but how call a popup after user change a value of field like my sample code that is when change zip code

thanks..
Title: Re: CASE MESSAGE on NT
Post by: bshields on November 06, 2019, 06:15:35 PM
Tick "Send new value to server", then in that embed, check if the value changed.

There is a javascript function called ntd.push that will open a popup window for you. I also think in a newer version of NT (then what I user), there may be a nicer way to access it.

Use p_web.script & ntd.push to open your popup (dont forget you need to tell NT you are using a popup window by calling YourMessage(p_web,Net:Web:Popup) in your calling screens init stuff.

eg.

IF ValueChanged = True
  p_web.Script('ntd.push(''YourMessage'',other parameters I cannot recall go here);')
.




Title: Re: CASE MESSAGE on NT
Post by: osquiabro on November 08, 2019, 10:12:54 AM
bshields, thanks for your guide, look how it looks
Title: Re: CASE MESSAGE on NT
Post by: bshields on November 08, 2019, 03:39:46 PM
Perfect :)
Title: Re: CASE MESSAGE on NT
Post by: Johan de Klerk on November 08, 2019, 11:36:49 PM
Hi Osquiabro,

Wow that looks nice.

I need to do something similar but have not idea how and where to start.

Are you willing to give a step by step guide on how you have done this please.

Regards

Johan de Klerk
Title: Re: CASE MESSAGE on NT
Post by: osquiabro on November 09, 2019, 05:10:05 AM
hi Johan, this is small sample of call messagebox, the password field call a messagebox
Title: Re: CASE MESSAGE on NT
Post by: osquiabro on November 09, 2019, 08:08:24 AM
i have a trouble with this solutions, if try to restore the previous value if a user select NO the field  the code in embed no work more.

 the code in is:

case p_web.gsv('Loc:Response')
OF 1
    loc:alert='Return Value for MessageBox: '&p_web.gsv('Loc:Response') &' Yes'
OF 2
    loc:alert='Return Value for MessageBox: '&p_web.gsv('Loc:Response') &' No'
    p_web.SetSessionValue(' MAI:Password', p_web.gsv('Password') )
    do refresh::MAI:Password
END
Do SendMessage

the do refresh::MAI:Password kill the embed work again

the p_web.gsv('Password') is initialize in PreUpdate
Title: Re: CASE MESSAGE on NT
Post by: Johan de Klerk on November 09, 2019, 10:08:29 PM
Hi Osquiabro,

Thanks for the example.

However I can't open it, I am on C10.

Can you maybe export the DCT and App please.

Regards

Johan de klerk
Title: Re: CASE MESSAGE on NT
Post by: osquiabro on November 10, 2019, 04:21:49 AM
V10..