value,4,"\n"));
$parts = array_pad($parts, 4, "");
$field = "name}_Holder\" class=\"creditCardField\">" .
"name}[0]\" value=\"$parts[0]\" maxlength=\"4\" /> - " .
"name}[1]\" value=\"$parts[1]\" maxlength=\"4\" /> - " .
"name}[2]\" value=\"$parts[2]\" maxlength=\"4\" /> - " .
"name}[3]\" value=\"$parts[3]\" maxlength=\"4\" />";
return $field;
}
function dataValue() {
if(is_array($this->value)) return implode("", $this->value);
else return $this->value;
}
function jsValidation() {
$formID = $this->form->FormName();
$jsFunc =<<name');";
}
function validate($validator){
$i=0;
if($this->value) foreach($this->value as $part){
if(!$part || !(strlen($part) == 4) || !ereg("([0-9]{4})",$part)){
switch($i){
case 0: $number = "first"; break;
case 1: $number = "second"; break;
case 2: $number = "third"; break;
case 3: $number = "fourth"; break;
}
$validator->validationError(
$this->name,
sprintf(
_t('Form.VALIDATIONCREDITNUMBER', "Please ensure you have entered the %s credit card number correctly."),
$number
),
"validation",
false
);
return false;
}
$i++;
}
}
}