• Modifies the required state of a form element.

    Parameters

    • element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement

      The form element to modify.

      • Must be an instance of HTMLElement that supports the required attribute (e.g., input, select, textarea).
    • required: boolean

      The desired required state. Set to true to make the element required, false to make it optional.

    Returns void

    Throws

    If the provided element is null, undefined, or does not support the required attribute.

    See

    MDN Documentation for the required attribute

    Example

    // Get an input element by its GUID using ix.api.dom.getHtml
    const inputElement = ix.api.dom.getHtml("<ELEMENT-GUID>");

    // Make the input element required
    ix.api.dom.setRequired(inputElement, true);

    // Make the input element optional
    ix.api.dom.setRequired(inputElement, false);