NetTalk Central

Author Topic: Setting Form to view only  (Read 20688 times)

John Hickey

  • Administrator
  • Newbie
  • *****
  • Posts: 47
    • View Profile
    • Email
Setting Form to view only
« on: June 17, 2007, 02:27:50 PM »
On the Newsgroups, Gregg Matteson asked:

How do you set a form to view only , only while the form is in change mode?

I tried setting a session variable at the browse then using that value in a local variable in the form but no luck so far.

Bruce Johnson Answered:

on the advanced tab is
"View Only IF:"
field.

In this you can put any expression.

In your case the expression would be

p_web.GetSessionValue('UpdateInvoices_CurrentAction') = ChangeRecord
where "UpdateInvoices" is the name of this form procedure.

In 4.26 I'll be making it a little easier to test the "current action" as this is something that came up a few times on tour.

Incidentally if your code to determine whether it should be View only or not is too big, then you can set the variable
loc:viewonly in the form in the Generate Form embed point to 1.

Cheers
Bruce

John Hickey

  • Administrator
  • Newbie
  • *****
  • Posts: 47
    • View Profile
    • Email
Re: Setting Form to view only
« Reply #1 on: June 17, 2007, 02:28:56 PM »
Gregg Matteson then replied:


I know about the "view only if" prompt but your suggestion got me headed in the right direction.

in the generate Form | Start

I placed :

if p_web.GetSessionValue('UpdateInvoices_CurrentAction') = ChangeRecord AND Accesslevel = 0
        loc:viewonly = 1
        else
        loc:viewonly = 0
    end

the Accesslevel is assigned in the form setup from a session variable.

The result is users with limited access can enter an order but NOT edit orders.

What ever the client wants ;>)