mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2468 from nedmas/make-creditcardfield-use-template
FIX: Make CreditCardField use template
This commit is contained in:
commit
bb7c973e34
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
6
templates/forms/CreditCardField.ss
Normal file
6
templates/forms/CreditCardField.ss
Normal 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>
|
Loading…
Reference in New Issue
Block a user