Custom attributes

Description

Specify any custom attributes that you want to inject into the HTML markup for this control.

Discussion

The Custom attributes property can be used to add your own attributes to the HTML generated for the Textbox control. While a large number of attributes can be edited via properties in the Textbox control's properties (e.g. adding in-line styles, classnames, readonly, etc), not all attributes are included (such as the onpaste attribute). You can use this property to define these properties.

Disables pasting in the Textbox
onpaste="return false;"

A popular attribute is the 'Placeholder' attribute. This attribute can be used to add a native HTML5 watermark to the Textbox control. It's recommended that the 'Placeholder' attribute be used in lieu of the Watermark property.

placeholder="Type your name here"

You can also use this property to add your own attributes.

myProperty="this is my property"

Attributes can be set and read at runtime using JavaScript.

var ele = {dialog.object}.getPointer('TEXTBOX_1');
if (ele) {
    // Get property
    var propValue = ele.getAttribute("myProperty");
    alert(propValue);

    // Set property
    // IMPORTANT: if the property doesn't exist, setAttribute will create it
    ele.setAttribute("myProperty","Property set");
}

See Also