Saltar para o conteúdo principal
Versão: 21 BETA

WebForm

The WebForm class contains functions and properties allowing to handle your Qodly web page components. 4D.WebForm objects are instantiated with the webForm command.

História
ReleaseMudanças
20 R6Adição de enableState() e disableState()
20 R2Adicionado

Comandos e funções


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

Descrição

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. These objects have functions that you can use to manage your components dynamically.

Exemplo

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

info

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âmetroTipoDescrição
statestring->Name of state to disable from the web page

Descrição

The .disableState() function disables the rendering of the state in the current web page.

Essa função não faz nada se:

  • the state is currently not enabled in the web page,
  • the state does not exist for the web page.

Se você enable ou desativar vários estados na mesma função de usuário, todas as modificações são enviadas em simultâneo, para o cliente quando a função termina.

For more information on web pages states, please refer to the States section in the Qodly documentation.

.enableState()

.enableState( state : string )

ParâmetroTipoDescrição
statestring->Name of state to enable on the web pages

Descrição

The .enableState() function enables the rendering of the state in the current web page.

Essa função não faz nada se:

  • the state has already been enabled on the web page,
  • the state does not exist for the web page.

Se você ativar ou desativar vários estados dentro da mesma função de usuário, todas as modificações serão enviadas ao mesmo tempo, para o cliente quando a função terminar.

For more information on web page states, please refer to the States section in the Qodly documentation.

Exemplo

Você ativa um estado específico chamado "wrongCredentials" em caso de erro em sua página de conexão:

Function authenticationError()
If (Session.info.type#"remote")
Web Form.enableState("wrongCredentials")
End if

.setError()

.setError( msg : string)

ParâmetroTipoDescrição
msgstring->Error message to display in the web page

Descrição

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".

Exemplo

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âmetroTipoDescrição
msgstring->Information message to display in the web page

Descrição

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".

Exemplo

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âmetroTipoDescrição
msgstring->Warning message to display in the web page

Descrição

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".

Exemplo

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:

Veja também

Web Form
Web Event
WebFormItem class