Tech Tip: Assure to declare parameter $1 in 4DAction method to avoid web server error 500
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: September 12, 2022
When working with web server and 4DAction methods, make sure to explicitly declare the $1 parameter using C_TEXT($1) in order for the method to work properly when running in compiled mode as 4D requires this parameter internally. Otherwise, the 4DAction method may cause a "500 - Internal Server Error" when accessing the method via web server. Note the C_TEXT($1) declaration is only required in compiled mode and not interpreted.
Take the 4DAction method below when running web server in interpreted vs compiled:
WEB SEND TEXT("Hello world") |
Interpreted (works properly):
Compiled (does not work without $1 declaration):
As mentioned before, this issue is fixed by simply adding the C_TEXT($1) declaration.
C_TEXT($1) WEB SEND TEXT("Hello world") |