NetTalk Central

Author Topic: Message on a Popup.  (Read 3913 times)

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Message on a Popup.
« on: September 12, 2016, 09:56:46 AM »
for years, I used code like this when calling a form from a browse,
at the  top of  GenerateForm Routine for the Form:
Code: [Select]
if some condition
   packet.SetValue(  'Security Restriction (' & P_WEB.GSV('Loc:PrivatePage') & '), This Action is Not permitted for '  & p_web.gsv('ProfileLoginID') & '!'  )
   do SendPacket
   Return -3
end
My menus are such that this would  show the message,  that would appear under my menu - and stopping the action.
(Avoiding what Nettalk does by default- not serving the page with the user unaware of why?)

if the form is a popup, this does not work, the Return works but you get a blank (incomplete) popup, i would like to communicate to the user the reason that the form will not let them continue..

I was wondering if someone has a suggestion on how to  accomplish  showing an alert or  message on the popup for this circumstance?


TIA
poul

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Message on a Popup.
« Reply #1 on: September 14, 2016, 11:37:17 PM »
p_web.Script('ntAlert("Access to Browse denied","Security");')

Cheers
Bruce

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Message on a Popup.
« Reply #2 on: September 15, 2016, 08:25:26 AM »
Hi Bruce,

That may work when calling a Browse, but not when the browse has called a Popup Form, as it  will  show the contents of the popup form.
To avoid putting conditions on all the elements of the form,  i can simply short-stop out of a non_Popup form  GenerateForm with a return -3.

I think with a popup i would need to do what ever it requires to finish generating cleanly with some text and an ok button.
(or get in front of it somehow conditionally fake-out the popup stuff) But i have yet to find  a practical place to do this and at what stage... as its easy to break functionality elsewhere.

I currently do the  check in the GenerateForm  because i need to check after the LoadRelatedRecords Routine.

I tend to use tabs on my forms, so I guess i can  conditionally ignore them and show a special tab with the access message on it.,
but i was hoping for a generic solution as i have for the non-popups.

poul