mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #171 from Focus-Flow/feature/clear-button-text
Add support for defining clear button text.
This commit is contained in:
commit
93db1189eb
@ -21,6 +21,7 @@ class UserDefinedForm extends Page {
|
|||||||
*/
|
*/
|
||||||
private static $db = array(
|
private static $db = array(
|
||||||
"SubmitButtonText" => "Varchar",
|
"SubmitButtonText" => "Varchar",
|
||||||
|
"ClearButtonText" => "Varchar",
|
||||||
"OnCompleteMessage" => "HTMLText",
|
"OnCompleteMessage" => "HTMLText",
|
||||||
"ShowClearButton" => "Boolean",
|
"ShowClearButton" => "Boolean",
|
||||||
'DisableSaveSubmissions' => 'Boolean',
|
'DisableSaveSubmissions' => 'Boolean',
|
||||||
@ -360,9 +361,11 @@ class UserDefinedForm extends Page {
|
|||||||
*/
|
*/
|
||||||
public function getFormOptions() {
|
public function getFormOptions() {
|
||||||
$submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
$submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
||||||
|
$clear = ($this->ClearButtonText) ? $this->ClearButtonText : _t('UserDefinedForm.CLEARBUTTON', 'Clear');
|
||||||
|
|
||||||
$options = new FieldList(
|
$options = new FieldList(
|
||||||
new TextField("SubmitButtonText", _t('UserDefinedForm.TEXTONSUBMIT', 'Text on submit button:'), $submit),
|
new TextField("SubmitButtonText", _t('UserDefinedForm.TEXTONSUBMIT', 'Text on submit button:'), $submit),
|
||||||
|
new TextField("ClearButtonText", _t('UserDefinedForm.TEXTONCLEAR', 'Text on clear button:'), $clear),
|
||||||
new CheckboxField("ShowClearButton", _t('UserDefinedForm.SHOWCLEARFORM', 'Show Clear Form Button'), $this->ShowClearButton),
|
new CheckboxField("ShowClearButton", _t('UserDefinedForm.SHOWCLEARFORM', 'Show Clear Form Button'), $this->ShowClearButton),
|
||||||
new CheckboxField("EnableLiveValidation", _t('UserDefinedForm.ENABLELIVEVALIDATION', 'Enable live validation')),
|
new CheckboxField("EnableLiveValidation", _t('UserDefinedForm.ENABLELIVEVALIDATION', 'Enable live validation')),
|
||||||
new CheckboxField("HideFieldLabels", _t('UserDefinedForm.HIDEFIELDLABELS', 'Hide field labels'))
|
new CheckboxField("HideFieldLabels", _t('UserDefinedForm.HIDEFIELDLABELS', 'Hide field labels'))
|
||||||
@ -560,13 +563,14 @@ class UserDefinedForm_Controller extends Page_Controller {
|
|||||||
*/
|
*/
|
||||||
public function getFormActions() {
|
public function getFormActions() {
|
||||||
$submitText = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
$submitText = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
||||||
|
$clearText = ($this->ClearButtonText) ? $this->ClearButtonText : _t('UserDefinedForm.CLEARBUTTON', 'Clear');
|
||||||
|
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
new FormAction("process", $submitText)
|
new FormAction("process", $submitText)
|
||||||
);
|
);
|
||||||
|
|
||||||
if($this->ShowClearButton) {
|
if($this->ShowClearButton) {
|
||||||
$actions->push(new ResetFormAction("clearForm"));
|
$actions->push(new ResetFormAction("clearForm", $clearText));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->extend('updateFormActions', $actions);
|
$this->extend('updateFormActions', $actions);
|
||||||
|
Loading…
Reference in New Issue
Block a user