ValidateAdditionalFields
%Plugin_Name%_ValidateAdditionalFields
Purpose
This function retrieves or validates custom domain fields.
Input Parameters
configarray: an array of parameters defined during plugin configuration.sld: a second-level domain name.tld: a top-level domain name.operationType: this parameter defines type of the operation that is performed. Possible values are:1: registration operation;2: transfer operation;3: renew operation;4: terminate operation.
additionalfields: a list of the additional fields to be validated. Applicable only ifoperationType=1.
Return Parameters
The method returns an array of associative arrays, each of which can have the following elements:
'type' => 'type': a type of an attribute. Possible values are:text,textarea,password,dropdown,radio,tickbox,yesno.'title' => 'title'(optional): a user-friendly name of an attribute. It will be displayed on the configuration form.'description' => 'description'(optional): the description of an attribute. It will be displayed on the configuration form.'defaultValue' => 'defval'(optional): the default value of an attribute.'required' => 'required'(optional): this key defines whether the attribute is mandatory (1: mandatory,0: optional).'status' => 'status': the status of the fields validation. Possible values are:1: Validation successfully completed.2: Validation failed.
'message' => 'message'(optional): a user-friendly error message, that will be shown in case field validation failed.'options' => 'value1,value2, ... , valueX'(optional, except for 'dropdown' and 'radio' attributes): a set of possible values for 'dropdown' or 'radio' attributes.
Note: The drop-down control cannot contain commas in the names of available options list. Also, the drop-down control will be correctly displayed only in CCP. In the PCP, it will be displayed as a simple text field.
Mandatory
Yes, if the plugin is able to register domains. This function must precede the RegisterDomain function.
Example
function Example_ValidateAdditionalFields($params)
{
define("EDIS_OK", 1);
define("EDIS_FAILED", 2);
$tld = $params["tld"];
$fields = array();
if ($tld == ".us") {
$fields["us_text"] = array("type" => "text",
"title" => _("Text Field"),
"description" => _("Text Field Description"),
"required" => 1, "status" => EDIS_OK);
$fields["us_dropdown"] = array("type" => "dropdown",
"title" => _("Dropdown Field"),
"description" => _("Dropdown Field Description"),
"options" => "Name1|Value1,Name2|Value2",
/* no commas are allowed in Name1 and Name2. Use other characters as separators, e.g., slashes, if needed */
"required" => 1, "status" => EDIS_OK
$fields["us_tickbox"] = array("type" => "tickbox",
"title" => _("Tickbox Field"),
"description" => _("Tickbox Field Description"),
"required" => 1, "status" => EDIS_OK
}
return $fields;
}