BUGFIX: Prevent duplicate HTML IDs in ModelAdmin

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@103519 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Luke Hudson 2010-04-26 23:27:42 +00:00 committed by Sam Minnee
parent 53f53bd27f
commit d36bc64f31

View File

@ -423,17 +423,17 @@ class ModelAdmin_CollectionController extends Controller {
}
$buttonLabel = sprintf(_t('ModelAdmin.CREATEBUTTON', "Create '%s'", PR_MEDIUM, "Create a new instance from a model class"), singleton($modelName)->i18n_singular_name());
$actions = new FieldSet(
$createButton = new FormAction('add', $buttonLabel)
);
$form = new Form($this, "CreateForm",
new FieldSet(),
$createButton = new FormAction('add', $buttonLabel),
$validator = new RequiredFields()
);
$createButton->dontEscape = true;
$validator = new RequiredFields();
$validator->setJavascriptValidationHandler('none');
return new Form($this, "CreateForm", new FieldSet(), $actions, $validator);
$form->setHTMLID("Form_CreateForm_" . $this->modelClass);
return $form;
}
/**
@ -488,6 +488,7 @@ class ModelAdmin_CollectionController extends Controller {
$actions,
$validator
);
$form->setHTMLID("Form_ImportForm_" . $this->modelClass);
return $form;
}