pp108 : setFormatType()

setFormatType()


It sets the specified format type for the control.

Syntax

Script

control.setFormatType(oFormatType)


Parameters

Parameter

Description

oFormat

Object. Refers to the format object that contains thedataTypeand other formatting attributes. This object must be retrieved using thegetFormatType()method.


Return Value


It returnstrueif the formatting is successful. Returnsfalseif formatting of the value in the field fails.

Remarks


This method overwrites the default format type set on the control.

Example

function Form_InitDone(eventObject)
{
    // get the format type for receivedDate field
    var receivedDateFormat = receivedDate.getFormatType();
    //set the display format as YYYY-MM-DD
    receivedDateFormat.setDisplayFormat("YYYY-MM-DD");
    //set the format type to receivedDate field again
    receivedDate.setFormatType(receivedDateFormat);
}

Applies to


Input, List, Output, Select, Textarea

Related reference

Format Type
getFormatType()