From d79d50770c09010777977396746103d053404e64 Mon Sep 17 00:00:00 2001 From: Tom Densham Date: Mon, 30 Sep 2013 16:48:15 +0100 Subject: [PATCH] FIX: Make CreditCardField use template --- forms/CreditCardField.php | 20 ++++++++++---------- templates/forms/CreditCardField.ss | 6 ++++++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 templates/forms/CreditCardField.ss diff --git a/forms/CreditCardField.php b/forms/CreditCardField.php index cdeb61c2c..e30b3687a 100644 --- a/forms/CreditCardField.php +++ b/forms/CreditCardField.php @@ -16,16 +16,16 @@ class CreditCardField extends TextField { $parts = array_pad($parts, 4, ""); // TODO Mark as disabled/readonly - $field = "name}_Holder\" class=\"creditCardField\">" - . "name}[0]\" value=\"$parts[0]\" maxlength=\"4\"" - . $this->getTabIndexHTML(0) . " /> - " - . "name}[1]\" value=\"$parts[1]\" maxlength=\"4\"" - . $this->getTabIndexHTML(1) . " /> - " - . "name}[2]\" value=\"$parts[2]\" maxlength=\"4\"" - . $this->getTabIndexHTML(2) . " /> - " - . "name}[3]\" value=\"$parts[3]\" maxlength=\"4\"" - . $this->getTabIndexHTML(3) . " />"; - return $field; + $properties['ValueOne'] = $parts[0]; + $properties['ValueTwo'] = $parts[1]; + $properties['ValueThree'] = $parts[2]; + $properties['ValueFour'] = $parts[3]; + $properties['TabIndexOne'] = $this->getTabIndexHTML(0); + $properties['TabIndexTwo'] = $this->getTabIndexHTML(1); + $properties['TabIndexThree'] = $this->getTabIndexHTML(2); + $properties['TabIndexFour'] = $this->getTabIndexHTML(3); + + return parent::Field($properties); } /** diff --git a/templates/forms/CreditCardField.ss b/templates/forms/CreditCardField.ss new file mode 100644 index 000000000..588a15f5b --- /dev/null +++ b/templates/forms/CreditCardField.ss @@ -0,0 +1,6 @@ + + - + - + - + + \ No newline at end of file