silverstripe-userforms/tests/UserDefinedFormTest.yml
Damian Mooyman 5349bb7d3b API Use core validation for form submission
Fixes #350 and fixes #404
This change abandons validation via EditableFormField::validateField, as it bypassed too many core validation mechanisms (RequiredFields, etc).
In order to enforce consistency of editable field validation, display rules have been hard-disabled when a field is marked as required.
Since this removes functionality, I have incremented the major version number
2016-04-18 12:04:21 +12:00

268 lines
6.8 KiB
YAML

EditableFormStep:
form1step1:
Title: 'Step 1'
form3step1:
Title: 'Step 1'
form4step1:
Title: 'Step 1'
form5step1:
Title: 'Step 1'
form6step1:
Title: 'Step 1'
form6step2:
Title: 'Step 2'
form6step3:
Title: 'Step 2'
form7step1:
Title: 'Step 1'
EditableOption:
option-1:
Name: Option1
Title: Option 1
option-2:
Name: Option2
Title: Option 2
department-1:
Name: dept1
Title: sales@example.com
department-2:
Name: dept2
Title: accounts@example.com
option-3:
Name: Option3
Title: Option 3
option-4:
Name: Option4
Title: Option 4
option-5:
Name: Option5
Title: Option 5
option-6:
Name: Option6
Title: Option 6
option-7:
Name: Option7
Title: Red
option-8:
Name: Option8
Title: Blue
option-9:
Name: Option9
Title: Green
EditableTextField:
basic-text:
Name: basic-text-name
Title: Basic Text Field
basic-text-2:
Name: basic-text-name
Title: Basic Text Field
your-name-field:
Name: your-name
Title: Name
address-field:
Name: address
Title: Address
street-field:
Name: street
Title: Street
city-field:
Name: city
Title: City
required-text:
Name: required-text-field
Title: Required Text Field
CustomErrorMessage: Custom Error Message
Required: true
field-1:
Name: Field1
field-2:
Name: Field2
some-field:
Name: SomeField
another-required:
Name: required-text
Title: Required Text Field
Required: true
CustomErrorMessage: 'This field is required'
EditableDropdown:
basic-dropdown:
Name: basic-dropdown
Title: Basic Dropdown Field
Options: =>EditableOption.option-1, =>EditableOption.option-2
department-dropdown:
Name: department
Title: Department
Options: =>EditableOption.department-1, =>EditableOption.department-2
EditableCheckbox:
checkbox-1:
Name: checkbox-1
Title: Checkbox 1
checkbox-2:
Name: checkbox-1
Title: Checkbox 1
EditableCheckboxGroupField:
checkbox-group:
Name: check-box-group
Title: Check box group
Options: =>EditableOption.option-3, =>EditableOption.option-4
colour-checkbox-group:
Name: colours
Title: 'Select Colours'
Options: =>EditableOption.option-7, =>EditableOption.option-8, =>EditableOption.option-9
EditableEmailField:
email-field:
Name: email-field
Title: Email
another-email-field:
Name: required-email
Title: Enter your email
CustomErrorMessage: 'That email is not valid'
EditableRadioField:
radio-field:
Name: radio-option
Title: Radio Option
Options: =>EditableOption.option-5, =>EditableOption.option-6
EditableFieldGroupEnd:
group1end:
Name: group1end
EditableFieldGroup:
group1start:
Name: group1start
End: =>EditableFieldGroupEnd.group1end
UserDefinedForm_EmailRecipientCondition:
# filtered recipient 1
blank-rule:
ConditionOption: IsBlank
ConditionField: =>EditableTextField.your-name-field
not-blank-rule:
ConditionOption: IsNotBlank
ConditionField: =>EditableTextField.address-field
equals-rule:
ConditionOption: Equals
ConditionField: =>EditableTextField.street-field
ConditionValue: 'Matches Equals'
not-equals-rule:
ConditionOption: NotEquals
ConditionField: =>EditableTextField.city-field
ConditionValue: 'Matches Not Equals'
# filtered recipient 2
group-equals-rule:
ConditionOption: Equals
ConditionField: =>EditableCheckboxGroupField.colour-checkbox-group
ConditionValue: Red
group-not-equals-rule:
ConditionOption: NotEquals
ConditionField: =>EditableCheckboxGroupField.colour-checkbox-group
ConditionValue: Blue
UserDefinedForm_EmailRecipient:
recipient-1:
EmailAddress: test@example.com
EmailSubject: Email Subject
EmailFrom: no-reply@example.com
no-html:
EmailAddress: nohtml@example.com
EmailSubject: Email Subject
EmailFrom: no-reply@example.com
SendPlain: true
no-data:
EmailAddress: nodata@example.com
EmailSubject: Email Subject
EmailFrom: no-reply@example.com
HideFormData: true
unfiltered-recipient-1:
EmailAddress: unfiltered@example.com
EmailSubject: Email Subject
EmailFrom: no-reply@example.com
filtered-recipient-1:
EmailAddress: filtered1@example.com
EmailSubject: Email Subject
EmailFrom: no-reply@example.com
CustomRules: =>UserDefinedForm_EmailRecipientCondition.blank-rule, =>UserDefinedForm_EmailRecipientCondition.not-blank-rule, =>UserDefinedForm_EmailRecipientCondition.equals-rule, =>UserDefinedForm_EmailRecipientCondition.not-equals-rule
CustomRulesCondition: 'And'
filtered-recipient-2:
EmailAddress: filtered2@example.com
EmailSubject: Email Subject
EmailFrom: no-reply@example.com
CustomRules: =>UserDefinedForm_EmailRecipientCondition.group-equals-rule, =>UserDefinedForm_EmailRecipientCondition.group-not-equals-rule
CustomRulesCondition: 'Or'
UserDefinedForm:
basic-form-page:
Content: '<p>Here is my form</p><p>$UserDefinedForm</p><p>Thank you for filling it out</p>'
Title: User Defined Form
Fields: =>EditableFormStep.form1step1,=>EditableTextField.basic-text
EmailRecipients: =>UserDefinedForm_EmailRecipient.recipient-1, =>UserDefinedForm_EmailRecipient.no-html, =>UserDefinedForm_EmailRecipient.no-data
page-with-group:
Content: 'Page with group'
Title: 'page with group'
Fields: =>EditableFormStep.form7step1, =>EditableFieldGroup.group1start, =>EditableTextField.some-field, =>EditableFieldGroupEnd.group1end
form-with-reset-and-custom-action:
Title: Form with Reset Action
SubmitButtonText: Custom Button
ShowClearButton: true
validation-form:
Title: Validation Form
Fields: =>EditableFormStep.form3step1,=>EditableTextField.required-text
custom-rules-form:
Title: Custom Rules Form
Fields: =>EditableFormStep.form4step1,=>EditableCheckbox.checkbox-2, =>EditableTextField.basic-text-2
empty-form:
Title: Empty Form
filtered-form-page:
Title: 'Page with filtered recipients'
Fields: =>EditableFormStep.form5step1,=>EditableCheckboxGroupField.checkbox-group, =>EditableTextField.your-name-field, =>EditableTextField.street-field, =>EditableTextField.city-field
EmailRecipients: =>UserDefinedForm_EmailRecipient.unfiltered-recipient-1, =>UserDefinedForm_EmailRecipient.filtered-recipient-1, =>UserDefinedForm_EmailRecipient.filtered-recipient-2
empty-page:
Title: 'Page with empty step'
Fields: =>EditableFormStep.form6step1, =>EditableTextField.field-1, =>EditableFormStep.form6step2, =>EditableTextField.field-2, =>EditableFormStep.form6step3
email-form:
Title: 'Page with email field'
Fields: =>EditableEmailField.another-email-field, =>EditableTextField.another-required