mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-09 03:01:18 +02:00
Merge pull request #2623 from tractorcow/pulls/3.2-form-naming-fixes
BUG 3.2 Issues with CMSForm not consistently respecting new form naming scheme
This commit is contained in:
commit
1a3a716352
@ -86,9 +86,4 @@ class CMSForm extends Form {
|
||||
return $this->responseNegotiator;
|
||||
}
|
||||
|
||||
public function FormName() {
|
||||
if($this->htmlID) return $this->htmlID;
|
||||
else return 'Form_' . str_replace(array('.', '/'), '', $this->name);
|
||||
}
|
||||
|
||||
}
|
@ -10,7 +10,7 @@ class CMSFormTest extends FunctionalTest {
|
||||
$response = $this->get('CMSFormTest_Controller');
|
||||
|
||||
$response = $this->submitForm(
|
||||
'Form_Form',
|
||||
'CMSForm_Form',
|
||||
'action_doSubmit',
|
||||
array(
|
||||
'Email' => 'test@test.com'
|
||||
@ -19,7 +19,7 @@ class CMSFormTest extends FunctionalTest {
|
||||
|
||||
// Firstly, assert that required fields still work when not using an exempt action
|
||||
$this->assertPartialMatchBySelector(
|
||||
'#SomeRequiredField span.required',
|
||||
'#CMSForm_Form_SomeRequiredField_Holder span.required',
|
||||
array(
|
||||
'"Some Required Field" is required'
|
||||
),
|
||||
@ -28,7 +28,7 @@ class CMSFormTest extends FunctionalTest {
|
||||
|
||||
// Re-submit the form using validation-exempt button
|
||||
$response = $this->submitForm(
|
||||
'Form_Form',
|
||||
'CMSForm_Form',
|
||||
'action_doSubmitValidationExempt',
|
||||
array(
|
||||
'Email' => 'test@test.com'
|
||||
@ -36,12 +36,12 @@ class CMSFormTest extends FunctionalTest {
|
||||
);
|
||||
|
||||
// The required message should be empty if validation was skipped
|
||||
$items = $this->cssParser()->getBySelector('#SomeRequiredField span.required');
|
||||
$items = $this->cssParser()->getBySelector('#CMSForm_Form_SomeRequiredField_Holder span.required');
|
||||
$this->assertEmpty($items);
|
||||
|
||||
// And the session message should show up is submitted successfully
|
||||
$this->assertPartialMatchBySelector(
|
||||
'#Form_Form_error',
|
||||
'#CMSForm_Form_error',
|
||||
array(
|
||||
'Validation skipped'
|
||||
),
|
||||
|
@ -693,7 +693,7 @@ class Form extends RequestHandler {
|
||||
|
||||
public function getAttributes() {
|
||||
$attrs = array(
|
||||
'id' => $this->getTemplateHelper()->generateFormID($this),
|
||||
'id' => $this->FormName(),
|
||||
'action' => $this->FormAction(),
|
||||
'method' => $this->FormMethod(),
|
||||
'enctype' => $this->getEncType(),
|
||||
|
Loading…
Reference in New Issue
Block a user