NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: asigala on August 11, 2009, 12:14:29 PM

Title: How to know if the call to a form was an insert, update or delete?
Post by: asigala on August 11, 2009, 12:14:29 PM
Hi everybody.

Mi question is how to detect what was the globalrequest to a form . is there any way to know it ?

What i want to do is condition some fields inside the form, if the form was called to update, i want to set them to read only.

Thanks in advance
Title: Re: How to know if the call to a form was an insert, update or delete?
Post by: Matthew51 on August 12, 2009, 10:55:28 AM
I think the easiest way is by checking the Change_btn value.

First check:
Code: [Select]
if ~p_web.IfExistsValue('Change_btn')
If the value doesn't exists then the form follows the default action (if you set it up).  This shouldn't happen unless you intend it to.
Then it's just a case statement:
Code: [Select]
case p_web.getvalue('Change_btn')
of 'Insert'
  code
of 'Delete'
  code
of 'Copy'
  code
of 'Update'
 code
end
Title: Re: How to know if the call to a form was an insert, update or delete?
Post by: Bruce on August 12, 2009, 11:06:02 PM
There's an easier way.

the loc:act variable is primed for you in the form. So you can test this to see the current action.
= one of
net:InsertRecord
net:ChangeRecord
net:CopyRecord
net:DeleteRecord

Cheers
Bruce
Title: Re: How to know if the call to a form was an insert, update or delete?
Post by: asigala on August 17, 2009, 04:04:57 PM
Many Thanks Mattew, and Bruce.

I founded this in a topic......

I think this should work and is a complement to Bruce sugestion.

I put this in the generateform star embed.

    if p_web.GetSessionValue('UpdatePedido2_CurrentAction') = ChangeRecord THEN
        loc:Truper = 1 ! The variable to set the condition
    else
        loc:Truper = 0
    end

Cheers

Alexis