SetValue Method for a Control

The SetValue method sets the contents for a control. This method does not return any information.

Format

controlVar.SetValue (controlValue)

The following table describes the arguments for the SetValue method.

Argument Description

controlValue

String that contains the value that Siebel CRM must set for the control.

Usage for the GetValue Method and the SetValue Method

Note the following usage for the SetValue method:

  • This method does not validate the format of the data. Data validation occurs when the user steps off the field or the record, or explicitly saves the record.

  • This method can set the value for a read-only control, but Siebel CRM does not save this information when the user saves the record.

  • The user can modify the contents of a control before Siebel CRM saves control information to the business component field.

Note the following usage for the GetValue method and the SetValue method:

  • These methods only work on form applets.

  • These methods work only for a control that references a business component field.

  • You cannot use these methods with a label.

Used With

Browser Script

Examples for the GetValue Method and the SetValue Method

The following code uses the GetValue method and the SetValue method:

function Applet_PreInvokeMethod (name, inputPropSet)
{

switch (name) {

  // Example of changing the value of the Abstract control to uppercase
  case ("SR Abstract"):
  {

    var ctlName = "Abstract";
    var ctl = this.FindControl(ctlName);
    var ctlVal = ctl.GetValue();
    ctl.SetValue(ctlVal.toUpperCase());
    ctl= null;
    return("CancelOperation");

  }

  // Example of changing the value of a checkbox control
  case ("SR Billable"):
  {

    var ctlName = "Billable Flag";
    var ctl = this.FindControl(ctlName);
    var ctlVal = ctl.GetValue();
    if (ctlVal == "Y")
       ctl.SetValue("N"); // clear the box
    else
       ctl.SetValue("Y"); // check the box
    ctl= null;
    return("CancelOperation");

  }

  // Example of changing the value of a date/time control
  case ("SR Commit time"):
  {

    var ctlName = "Agent Committed";
    var ctl = this.FindControl(ctlName);
    ctl.SetValue("12/1/2001 1:09:31 AM"); 
    // format is not validated until user saves the record
    ctl= null;
    return("CancelOperation");

  }

  break;

  }

}