Merge pull request #2468 from nedmas/make-creditcardfield-use-template

FIX: Make CreditCardField use template
This commit is contained in:
Ingo Schommer 2013-10-03 03:22:06 -07:00
commit bb7c973e34
2 changed files with 16 additions and 10 deletions

View File

@ -16,16 +16,16 @@ class CreditCardField extends TextField {
$parts = array_pad($parts, 4, ""); $parts = array_pad($parts, 4, "");
// TODO Mark as disabled/readonly // TODO Mark as disabled/readonly
$field = "<span id=\"{$this->name}_Holder\" class=\"creditCardField\">" $properties['ValueOne'] = $parts[0];
. "<input autocomplete=\"off\" name=\"{$this->name}[0]\" value=\"$parts[0]\" maxlength=\"4\"" $properties['ValueTwo'] = $parts[1];
. $this->getTabIndexHTML(0) . " /> - " $properties['ValueThree'] = $parts[2];
. "<input autocomplete=\"off\" name=\"{$this->name}[1]\" value=\"$parts[1]\" maxlength=\"4\"" $properties['ValueFour'] = $parts[3];
. $this->getTabIndexHTML(1) . " /> - " $properties['TabIndexOne'] = $this->getTabIndexHTML(0);
. "<input autocomplete=\"off\" name=\"{$this->name}[2]\" value=\"$parts[2]\" maxlength=\"4\"" $properties['TabIndexTwo'] = $this->getTabIndexHTML(1);
. $this->getTabIndexHTML(2) . " /> - " $properties['TabIndexThree'] = $this->getTabIndexHTML(2);
. "<input autocomplete=\"off\" name=\"{$this->name}[3]\" value=\"$parts[3]\" maxlength=\"4\"" $properties['TabIndexFour'] = $this->getTabIndexHTML(3);
. $this->getTabIndexHTML(3) . " /></span>";
return $field; return parent::Field($properties);
} }
/** /**

View File

@ -0,0 +1,6 @@
<span id="{$Name}_Holder" class="creditCardField">
<input autocomplete="off" name="{$Name}[0]" value="{$ValueOne}" maxlength="4" $TabIndexOne/> -
<input autocomplete="off" name="{$Name}[1]" value="{$ValueTwo}" maxlength="4" $TabIndexTwo/> -
<input autocomplete="off" name="{$Name}[2]" value="{$ValueThree}" maxlength="4" $TabIndexThree/> -
<input autocomplete="off" name="{$Name}[3]" value="{$ValueFour}" maxlength="4" $TabIndexFour/>
</span>