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(className : string) adds the class specified in className to the component |
.hide() hides the component |
.removeCSSClass(className: string) removes the class specified in className from the component |
.show() makes the component visible |
.addCSSClass()
.addCSSClass(className : string)
Parameter | Type | Description | |
---|---|---|---|
className | string | -> | Name 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)
Parameter | Type | Description | |
---|---|---|---|
className | string | -> | Name of the CSS class to remove from the component |
Description
The .removeCSSClass()
function removes the class specified in className from the component.
.hide()
.hide()
Parameter | Type | Description | |
---|---|---|---|
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:
- Select the image component on the canvas, and enter a server-side reference in the Properties Panel > Server Side, for example "myImage".
- 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
- Select the Button component and add an
onclick
event to it. - Attach the
isHidden
function to the event.
.show()
.show()
Parameter | Type | Description | |
---|---|---|---|
Does not require any parameters |
Description
The .show()
function makes the component visible. If the component was already visible, the function does nothing.