Telegram_2021-06-03T17

<< Click to Display Table of Contents >>

Navigation:  Telegram > 2021 > 06 > 03 >

Telegram_2021-06-03T17

Telegram link

 

2021-06-03T17:25:29

 

Execute method from the content handler

 


 

Telegram link

 

2021-06-03T17:25:44

 

when you create a new content handler you override the Execute method

 


 

Telegram link

 

2021-06-03T17:26:03

 

from there you have access to all parameters

 


 

Telegram link

 

2021-06-03T17:26:29

 

Could you provide an example? I am not sure I understand how to override the execute method.

 


 

Telegram link

 

2021-06-03T17:27:03

 

what type of content handler do you have?

 


 

Telegram link

 

2021-06-03T17:27:44

 

with THandlers.Add('/reset/', '', TContentForm.Create(TfrmReset)) do...

 


 

Telegram link

 

2021-06-03T17:34:15

 

Example

 


 

Telegram link

 

2021-06-03T17:35:49

 

Another option

 


 

Telegram link

 

2021-06-03T17:38:25

 

Does it need to be class(TContentForm) or can I use my existing class(TIWAppForm)?

 


 

Telegram link

 

2021-06-03T17:38:41

 

the content handler is not a form

 


 

Telegram link

 

2021-06-03T17:38:53

 

it must inherit from TContentForm (or TContentBase)

 


 

Telegram link

 

2021-06-03T17:39:20

 

a TContentForm instance is a class that uses a TIWForm to handle the request. But it is not a form

 


 

Telegram link

 

2021-06-03T17:40:23

 

it would be good if you could create a content handler like this (you need to change your registration as well).

 

And then you can put a breakpoint inside the Execute method and see if you are receiving the parameters from the Request

 


 

Telegram link

 

2021-06-03T17:41:19

 

So how would then display the form I want in the execute method? Sorry, I am missing something here.

 


 

Telegram link

 

2021-06-03T17:44:08

 

The Execute method of TContentForm (the inherited call) will take care of the form creation/execution. That's how it works

 


 

Telegram link

 

2021-06-03T17:44:43

 

ok, so just change class(TIWAppForm) to be class(TContentForm)?

 


 

Telegram link

 

2021-06-03T17:44:50

 

nope

 


 

Telegram link

 

2021-06-03T17:45:42

 

Add this unit as it to your project

 


 

Telegram link

 

2021-06-03T17:46:39

 

then add it to the uses clause to the unit that you are registering the content handler.

 

Then change it into:

 

with THandlers.Add('/reset/', '', TMyContentForm.Create(TfrmReset)) do...

 


 

Telegram link

 

2021-06-03T17:46:54

 

instead of a TContentForm you will create a TMyContentForm

 


 

Telegram link

 

2021-06-03T17:47:26

 

then you can put a breakpoint inside Execute method of that unit and see what parameters you are receiving

 


 

Telegram link

 

2021-06-03T17:53:47

 

I can't seem to call webapplication from the execute method. Says it's undeclared?

 


 

Telegram link

 

2021-06-03T17:54:39

 

You have the Session parameter which is exactly the IWApplication instance

 


 

Telegram link

 

2021-06-03T17:54:41

 

Looks like I need to use aSession

 


 

Telegram link

 

2021-06-03T17:54:45

 

yes

 


 

Telegram link

 

2021-06-03T17:54:55

 

always make sure that it is assigned

 


 

Telegram link

 

2021-06-03T17:56:59

 

How would I access the user session? TIWUserSession(aSession.Data).GIDParamStr := aSession.RunParams.Values['gid'];