WebForm
The WebForm class contains functions and properties allowing to handle your Qodly web page components. Los objetos 4D.WebForm se instancian con el comando webForm.
Historia
| Lanzamiento | Modificaciones |
|---|---|
| 20 R6 | Adición de enableState() y disableState() |
| 20 R2 | Añadidos |
Comandos y funciones
objects that are available directly as properties |
| .disableState( state : string) disables the rendering of the state in the current web page |
| .enableState( state : string ) enables the rendering of the state in the current web page |
| .setError( msg : string) sends msg as an error message to the web page |
| .setMessage( msg : string) sends msg as an information message to the web page |
| .setWarning( msg : string) sends msg as a warning message to the web page |
.componentName
.componentName : 4D.WebFormItem
Descripción
The components of web pages are objects that are available directly as properties of these web pages.
The returned objects are of the 4D.WebFormItem class. Estos objetos tienen funciones que puede utilizar para gestionar sus componentes de forma dinámica.
Ejemplo
shared singleton Class constructor()
var myForm : 4D.WebForm
var component : 4D.WebFormItem
myForm:=webForm //returns the web page as an object, each property is a component
component:=myForm.myImage //returns the myImage component of the web page
While myForm may not display typical object properties when examined in the debugger, it behaves as if it were the actual webForm object. You can interact with the underlying webForm object's properties and functions through myForm. For example, you can dynamically manipulate page components or transmit messages to web pages using specialized functions like myForm.setMessage().
.disableState()
.disableState( state : string)
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| state | string | -> | Nombre del estado a desactivar de la página web |
Descripción
The .disableState() function disables the rendering of the state in the current web page.
Esta función no hace nada si:
- the state is currently not enabled in the web page,
- el estado no existe para la página web.
Si activa o desactiva varios estados en la misma función usuario, todas las modificaciones se envían al mismo tiempo al cliente una vez finalizada la función.
For more information on web pages states, please refer to the States section in the Qodly documentation.
.enableState()
.enableState( state : string )
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| state | string | -> | Nombre del estado a activar en las páginas web |
Descripción
The .enableState() function enables the rendering of the state in the current web page.
Esta función no hace nada si:
- the state has already been enabled on the web page,
- el estado no existe para la página web.
Si activa o desactiva varios estados dentro de la misma función usuario, todas las modificaciones se envían al mismo tiempo al cliente una vez que la función termina.
For more information on web page states, please refer to the States section in the Qodly documentation.
Ejemplo
Usted activa un estado específico llamado "wrongCredentials" en caso de error en su página de conexión:
Function authenticationError()
If (Session.info.type#"remote")
Web Form.enableState("wrongCredentials")
End if
.setError()
.setError( msg : string)
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| msg | string | -> | Error message to display in the web page |
Descripción
The .setError() function sends msg as an error message to the web page.
The function returns a response with a 200 OK status and a __WEBFORM object in the body with a __NOTIFICATION.message property set to msg and a __NOTIFICATION.type set to "error".
Ejemplo
shared singleton Class constructor()
exposed function myError()
var myForm : 4D.WebForm
myForm:=web Form
myForm.setError("My error message")
If the Provide feedback feature is enabled for the event, the message is automatically displayed as a red toast at the bottom of the Page and disappears automatically after 5 seconds:
.setMessage()
.setMessage( msg : string)
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| msg | string | -> | Mensaje de información a mostrar en la página web |
Descripción
The .setMessage() function sends msg as an information message to the web page.
The function returns a response with a 200 OK status and a __WEBFORM object in the body with a __NOTIFICATION.message property set to msg and a __NOTIFICATION.type set to "message".
Ejemplo
shared singleton Class constructor()
exposed function myMessage()
var myForm : 4D.WebForm
myForm:=web Form
myForm.setMessage("My information message")
If the Provide feedback feature is enabled for the event, the message is automatically displayed as a green toast at the bottom of the Page and disappears automatically after 5 seconds:
.setWarning()
.setWarning( msg : string)
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| msg | string | -> | Mensaje de advertencia para mostrar en la página web |
Descripción
The .setWarning() function sends msg as a warning message to the web page.
The function returns a response with a 200 OK status and a __WEBFORM object in the body with a __NOTIFICATION.message property set to msg and a __NOTIFICATION.type set to "warning".
Ejemplo
shared singleton Class constructor()
exposed function myWarning()
var myForm : 4D.WebForm
myForm:=web Form
myForm.setWarning("My warning message")
If the Provide feedback feature is enabled for the event, the message is automatically displayed as a yellow toast at the bottom of the web page and disappears automatically after 5 seconds: