Replaces an existing value of a search field if the field is already added to the search panel.
Adds the field to the search panel if didn't exist there previously.
Syntax
setFieldValue($field, $value);
Arguments
$field
the name of the field.
$value
the value of the search field.
Return value
No return value.
Example
Sets the Department search field to 10 if it is empty. Add the following code to the AfterTableInit event of the List page:
$srchObj = SearchClause::getSearchObject("Employees");
$value = $srchObj->getFieldValue("Department");
if( $value == null ) {
$srchObj->setFieldValue("Department", 10 );
}
See also: