GetFieldChoiceType

Description

Returns the choice list type for the given field.

The return value is a ChoiceType constant, either CLOSED_CHOICE or OPEN_CHOICE. If the return value is CLOSED_CHOICE, the valid values for the field are limited to those specified in the choice list. If the return value is OPEN_CHOICE, the user may select an item from the choice list or type in a new value.

Syntaxe

VBScript

entity.GetFieldChoiceType field_name 

Perl

$entity->GetFieldChoiceType(field_name); 
Identificateur
Description
entity
Objet Entity représentant un enregistrement de données utilisateur. Si vous omettez cette partie de la syntaxe au sein d'un point d'ancrage, l'objet Entity correspondant à l'enregistrement de données en cours est faux (VBScript uniquement).
nom_zone
Chaîne identifiant un nom de zone valide d'entité.
Valeur renvoyée
A Long indicating the type of the field. This value is one of the ChoiceType constants.

Exemples

VBScript

' If the field must have a value from a closed choice list, assign 
' the first value in the list to the field by default. 
choiceType = GetFieldChoiceType("field1") 
If choiceType = AD_CLOSED_CHOICE Then 
   ' Set the field to the first item in the choice list. 
   fieldChoiceList = GetFieldChoiceList("field1") 
   SetFieldValue "field1", fieldChoiceList(0) 
End If 

Perl

# If the field must have a value from a closed choice list, assign
# the first value in the list to the field by default. 

$choicetype = $entity->GetFieldChoiceType("field1");
if ($choicetype eq $CQPerlExt::CQ_CLOSED_CHOICE)
{
# Set the field to the first item in the choice list. 
$fieldchoicelist = $entity->GetFieldChoiceList("field1");
$entity->SetFieldValue("field1",@$fieldchoicelist[0]);
} 

Feedback