WebFormItem
When working in 4D Web Studio, the WebFormItem
class allows you to handle the behavior of webform components on the server side.
#
WebFormItem Objects4D.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()
#
DescriptionThe .hide() function hides the component.
#
ExampleTo 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:
var $myComponent: 4D.WebFormItem
$myComponent:=Web Form.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()History
|Version|Changes| |---|---| |v19 R3|Added|.show()
#
DescriptionThe .show function makes the component visible.
#
.addCSSClass()History
|Version|Changes| |---|---| |v19 R3|Added|.addCSSClass(className : Text)
Parameter | Type | Description | |
---|---|---|---|
className | Text | -> | Name of the CSS class to add to the component |
#
DescriptionThe .addCSSClass function adds the class specified in className to the component.
#
.removeCSSClass()History
|Version|Changes| |---|---| |v19 R3|Added|.removeCSSClass(className: Text)
Parameter | Type | Description | |
---|---|---|---|
className | Text | -> | Name of the CSS class to remove from the component |
#
DescriptionThe .removeCSSClass() function removes the class specified in className from the component.