Skip to main content
Version: 1.0.0

WebFormItem

The 4D.WebFormItem class allows you to handle the behavior of your webform components.

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

When you call the webForm command, the returned 4D.WebForm proxy 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.

Functions and properties

    
    
    
    

.addCSSClass()

.addCSSClass(className : string)

ParameterTypeDescription
classNamestringName of the CSS class to add to the component

Description

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

.removeCSSClass()

.removeCSSClass(className: string)

ParameterTypeDescription
classNamestringName of the CSS class to remove from the component

Description

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

.hide()

.hide()

ParameterTypeDescription
Does not require any parameters

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:
exposed function isHidden()

var myComponent : 4D.WebFormItem

myComponent = webForm.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()

.show()

ParameterTypeDescription
Does not require any parameters

Description

The .show() function makes the component visible. If the component was already visible, the function does nothing.