Skip to main content

WebFormItem

When working in 4D Web Studio, the WebFormItem class allows you to handle the behavior of webform components on the server side.

WebFormItem Objects#

4D.WebFormItem objects are properties of the 4D.WebForm object returned by the Web Form command.

When you call the Web Form command, the returned 4D.WebForm object holds as many 4D.WebFormItems as there are components with server-side references in your webform.

For example, WebFormObject.myImage refers to the image component with myImage as server reference.

4D.WebFormItem objects have class functions that allow you to modify the behavior of webforms and their components.

.hide()#

History|Version|Changes| |---|---| |v19 R3|Added|

.hide()

Description#

The .hide() function hides the component.

Example#

To call a function that hides an image when the user clicks a button:

  1. Select the image component on the canvas, and enter a server-side reference in the Properties Panel > Server Side, for example myImage.
  2. Create an exposed function named isHidden that contains the following code:
var $myComponent: 4D.WebFormItem
$myComponent:=Web Form.myImage$myComponent.hide() // Hide the component that has "myImage" as server reference 
  1. Select the Button component and add an onclick event to it.
  2. Attach the isHidden function to the event.

.show()#

History|Version|Changes| |---|---| |v19 R3|Added|

.show()

Description#

The .show function makes the component visible.

.addCSSClass()#

History|Version|Changes| |---|---| |v19 R3|Added|

.addCSSClass(className : Text)

ParameterTypeDescription
classNameText->Name of the CSS class to add to the component

Description#

The .addCSSClass function adds the class specified in className to the component.

.removeCSSClass()#

History|Version|Changes| |---|---| |v19 R3|Added|

.removeCSSClass(className: Text)

ParameterTypeDescription
classNameText->Name of the CSS class to remove from the component

Description#

The .removeCSSClass() function removes the class specified in className from the component.