Package com.orchestranetworks.ui

# Class UIFormSpec

java.lang.Object
com.orchestranetworks.ui.UIFormSpec

public final class UIFormSpec extends Object
In the context of User services, specifies the general features of an HTML form.

### Note

This class if for compatibility with user services developed using older versions of EBX®. This class must not be used with user services implementing interface `UserService`.

### Bottom bar

It is possible to set the buttons in a bottom bar.

This feature enables a special layout for the workspace: the bottom bar is fixed at the bottom, and the scrollbar on the right is drawn to fit the space between the header and the bottom bar.

All properties of this object must be set before calling `UIServiceComponentWriter.startForm(UIFormSpec)`.

Caution: Due to this special layout, no content (HTML code) is allowed before or after the form.

Since:
  5.2.0
See Also:
  - `UIServiceComponentWriter.startForm(UIFormSpec)`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UIFormSpec()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addActionBackInBottomBar(UIButtonSpec actionBack)`
  Adds a button on the left side of the bottom bar.
  `void`
  `addActionBackInBottomBar(UIButtonSpec actionBack, boolean isPreviousStep)`
  Adds a button on the left side of the bottom bar.
  `void`
  `addActionForwardInBottomBar(UIButtonSpec actionForward)`
  Adds a button on the right side of the bottom bar.
  `void`
  `addActionForwardInBottomBar(UIButtonSpec actionForward, boolean isNextStep)`
  Adds a button on the right side of the bottom bar.
  `void`
  `addActionInplaceInBottomBar(UIButtonSpec actionInplace)`
  Adds a button at the center of the bottom bar.
  `void`
  `setDetectionOfLostModificationDisabled(boolean isDisabled)`
  Sets whether or not the user is prompted for a confirmation when input has been entered in the form, but the page is abandoned before saving the input.
  `void`
  `setId(String id)`
  Defines the HTML id for the `form` element.
  `void`
  `setJsFnNameToCallBeforeSubmit(String jsFnNameToCallBeforeSubmit)`
  Sets a JavaScript's function to be called before submitting the form.
  `void`
  `setMarginForContent(boolean hasMarginForContent)`
  Deprecated.
  Since 5.4.0 which provides new look & feel.
  `void`
  `setMultipart(boolean isMultipart)`
  Defines whether of not the form has multiple parts.
  `void`
  `setURLForAction(String urlForAction)`
  Defines the URL of the `action` attribute of the `form`.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UIFormSpec

    public UIFormSpec()

- ## Method Details

  - ### addActionBackInBottomBar

    public void addActionBackInBottomBar(UIButtonSpec actionBack)
    Adds a button on the left side of the bottom bar.

    Caution: If the form contains a bottom bar, no content (HTML code) is allowed before or after the form.

    Parameters:
      `actionBack` - the button's specification.
    See Also:
      - `UIButtonSpecSubmit`

  - ### addActionBackInBottomBar

    public void addActionBackInBottomBar(UIButtonSpec actionBack, boolean isPreviousStep)
    Adds a button on the left side of the bottom bar.

    Caution: If the form contains a bottom bar, no content (HTML code) is allowed before or after the form.

    Parameters:
      `actionBack` - the button's specification.
      `isPreviousStep` - `true` to defines that the button will induce the previous screen/step, `false` otherwise.
    See Also:
      - `UIButtonSpecSubmit`

  - ### addActionForwardInBottomBar

    public void addActionForwardInBottomBar(UIButtonSpec actionForward)
    Adds a button on the right side of the bottom bar.

    Caution: If the form contains a bottom bar, no content (HTML code) is allowed before or after the form.

    Parameters:
      `actionForward` - the button's specification.
    See Also:
      - `UIButtonSpecSubmit`

  - ### addActionForwardInBottomBar

    public void addActionForwardInBottomBar(UIButtonSpec actionForward, boolean isNextStep)
    Adds a button on the right side of the bottom bar.

    Caution: If the form contains a bottom bar, no content (HTML code) is allowed before or after the form.

    Parameters:
      `actionForward` - the button's specification.
      `isNextStep` - `true` to defines that the button will induce the next screen/step, `false` otherwise.
    See Also:
      - `UIButtonSpecSubmit`

  - ### addActionInplaceInBottomBar

    public void addActionInplaceInBottomBar(UIButtonSpec actionInplace)
    Adds a button at the center of the bottom bar.

    Caution: If the form contains a bottom bar, no content (HTML code) is allowed before or after the form.

    Parameters:
      `actionInplace` - the button's specification.
    See Also:
      - `s`

  - ### setId

    public void setId(String id)
    Defines the HTML id for the `form` element.

    This id is useful for finding the `form` element using JavaScript. For instance, to list a form's elements.

    The id attribute must respect the W3C Recommendation (such as being unique in the page). See https://www.w3.org/TR/REC-html40/struct/global.html#adef-id for more information.

    Parameters:
      `id` - the HTML id of the `form`.

  - ### setJsFnNameToCallBeforeSubmit

    public void setJsFnNameToCallBeforeSubmit(String jsFnNameToCallBeforeSubmit)
    Sets a JavaScript's function to be called before submitting the form.

    The DOM form element will be given as an argument of this function.

    Example:
    JavaScript `function checkFormValidity(formEl) {
    if (formEl.elements["ckbAcceptConditions"].checked) {
    return true; // the form will be sent
    } else {
    alert("Check the box to accept conditions.");
    return false; // the form will NOT be sent
    }
    }`
    Java `myFormSpec.setJsFnNameToCallBeforeSubmit("checkFormValidity");`

    If the JavaScript's function returns `true` and the clicked submit button has a confirmation message, the confirmation message will be displayed after calling of the JavaScript's function.

    If the form is submitted by clicking a submit button, that button can be accessed using `formEl.ebx_lastSubmitFocused` ; otherwise `formEl.ebx_lastSubmitFocused` is `null`.

    Parameters:
      `jsFnNameToCallBeforeSubmit` - the name of the JavaScript function to call before submitting the form.

  - ### setMarginForContent

    @Deprecated public void setMarginForContent(boolean hasMarginForContent)
    Deprecated.
    Since 5.4.0 which provides new look & feel. `UICSSClasses.CONTAINER_WITH_TEXT` can still be used to include a margin around text.
    Forms are used to display node values (tree layout), or other content (text layout). In the latter case, it is advised to set a thin margin for content, otherwise information will be flush against the left border.

    Default value is `false`.

    Parameters:
      `hasMarginForContent` - `true` to enable margin for content, `false` otherwise.

  - ### setMultipart

    public void setMultipart(boolean isMultipart)
    Defines whether of not the form has multiple parts. This is required in order to enable file uploads.

    Default value is `false`.

    Parameters:
      `isMultipart` - `true` to enable multipart, `false` otherwise.

  - ### setURLForAction

    public void setURLForAction(String urlForAction)
    Defines the URL of the `action` attribute of the `form`.

    By default, the URL is `null`, so the form will submit values to the current page.

    Parameters:
      `urlForAction` - the URL of the `action` attribute of the `form`.

  - ### setDetectionOfLostModificationDisabled

    public void setDetectionOfLostModificationDisabled(boolean isDisabled)
    Sets whether or not the user is prompted for a confirmation when input has been entered in the form, but the page is abandoned before saving the input.

    Default value is `false`.

    Parameters:
      `isDisabled` - `true` to disable form detection upon leaving the page, `false` to enable it and reset to default.
    See Also:
      - `UIButtonSpecNavigation.setAskBeforeLeavingModifiedForm(boolean)`