BUGFIX: Prevent duplicate HTML IDs in ModelAdmin (from r103519)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111667 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-04 06:16:40 +00:00
parent 26f987e67f
commit f55968789b

View File

@ -425,17 +425,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;
}
/**
@ -490,6 +490,7 @@ class ModelAdmin_CollectionController extends Controller {
$actions,
$validator
);
$form->setHTMLID("Form_ImportForm_" . $this->modelClass);
return $form;
}