You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -456,6 +457,14 @@ By default the value is `false`. This ensures that, in an upgrade scenario, befo
456
457
457
458
To make the feature available to editors set the value to `true`.
458
459
460
+
## EnableAdvancedValidationRules
461
+
462
+
This setting determines whether [advanced form validation rules](../../editor/creating-a-form/form-advanced.md) are available to editors.
463
+
464
+
By default, the value is `false`. This is partly because the feature is only considered for "power users", comfortable with crafting rules using the required JSON syntax. And partly as validating the rules on the client requires an additional front-end dependency.
465
+
466
+
To make the feature available to editors and include the dependency when using `@Html.RenderUmbracoFormDependencies(Url)`, set the value to `true`.
In this article, you will find information about accessing the Forms Advanced Options and the features available to customize your Form.
4
+
5
+
To access the Form Advanced Options:
6
+
7
+
1. Navigate to the **Forms** section.
8
+
2. Open a Form you wish to customize.
9
+
3. Click **Advanced** in the top-right corner of the screen.
10
+
11
+
{% hint style="info" %}
12
+
The advanced options for forms are only available when [configured to display](../../developer/configuration/README.md#enableadvancedvalidationrules).
13
+
{% endhint %}
14
+
15
+
## Validation Rules
16
+
17
+
When creating forms you can add validation to individual fields, making them mandatory or applying a regular expression pattern. You can provide validation rules for the entire form via the advanced options. This allows you to validate expressions based on multiple fields. For example, "these two email fields should be the same", or "this date should be after this other one".
To add new rules, you need to provide the rule definition, an error message and select a field to which the message will be associated. Once created you can click to edit or delete them from the list.
22
+
23
+
Crafting the rule definition itself requires use of [JSON logic](https://jsonlogic.com/) along with placeholders for the field or fields that are being validated.
24
+
25
+
### Examples
26
+
27
+
One example use case would be ensuring that two fields match each other, perhaps when asking for a user's email address. Given two fields on the form, one with the alias of `email` and the other `compareEmail`, the rule would be:
28
+
29
+
```json
30
+
{
31
+
"==": [
32
+
"{email}",
33
+
"{compareEmail}"
34
+
]
35
+
}
36
+
```
37
+
38
+
A slightly more complex example could be with two dates, where, if provided, you want to ensure the second date is later than the first. So given fields with aliases of `startDate` and `endDate` a rule would look like this:
39
+
40
+
```json
41
+
{
42
+
"or": [
43
+
{
44
+
"==": [
45
+
"{startDate}",
46
+
""
47
+
]
48
+
},
49
+
{
50
+
"==": [
51
+
"{endDate}",
52
+
""
53
+
]
54
+
},
55
+
{
56
+
">": [
57
+
"{endDate}",
58
+
"{startDate}"
59
+
]
60
+
}
61
+
]
62
+
}
63
+
```
64
+
65
+
Rules can be nested too. In this final illustrative example, we have two fields. One with the alias `choose` is a drop-down list with two values: `A` and `B`. The second field with alias `test` we want to be completed only if the user selects `B`. So we create a rule that is valid only if A is selected OR B is selected AND `test` is completed.
66
+
67
+
```json
68
+
{
69
+
"or": [
70
+
{
71
+
"==": [
72
+
"{choose}",
73
+
"A"
74
+
]
75
+
},
76
+
{
77
+
"and": [
78
+
{
79
+
"==": [
80
+
"{choose}",
81
+
"B"
82
+
]
83
+
},
84
+
{
85
+
"!=": [
86
+
"{test}",
87
+
""
88
+
]
89
+
}
90
+
]
91
+
}
92
+
]
93
+
}
94
+
```
95
+
96
+
Overall, you can create rules of varying complexity, using comparisons between fields and static values.
97
+
98
+
When the form is rendered, these validation rules will be applied on both the client and server-side. In this way, you can ensure the submission is only accepted if it meets the requirements.
When creating forms you are able to add validation to individual fields, making them mandatory or applying a regular expression pattern. With the 13.4 release we are looking to make this more powerful, by allowing the addition of validation rules for the entire form. The idea is that this will allow you to validate expressions based on multiple fields. For example, "these two email fields should be the same", or "this date should be after this other one".
24
+
25
+
Crafting these rules requires use of [JSON logic](https://jsonlogic.com/) so is considered a "power user" feature. They also require an additional front-end dependency for the rendering of forms on the website. As such they are surfaced on a new "Advanced" tab and only visible and used if enabled in configuration. We don't have, and it seems difficult to provide, an intuitive user interface for rule creation taking into account all the flexibility available. Nonetheless, having the ability to use more complex validation rules seems a valuable addition.
26
+
27
+
When the form is rendered, the validation rules will be applied on the client, where we support both the `aspnet-client-validation` and `jquery.validate` libraries. They are also verified server-side. In this way you can ensure the submission is only accepted if it meets the requirements.
28
+
29
+
Feedback on this feature in particular is welcome.
30
+
31
+
Read more about [editing advanced validation rules](./editor/creating-a-form/form-advanced.md) as well as the [configuration option required to enable them](./developer/configuration/README.md#enableadvancedvalidationrules).
32
+
33
+
##### Tracking editor activity
34
+
35
+
Whilst previously we tracked and displayed the date a form was created and last edited, we didn't show who had made these updates. With 13.4 installed we will start to track this and display the information where available. You'll find this on the form, data source or prevalue source's "Info" tab [#1315](https://github.com/umbraco/Umbraco.Forms.Issues/issues/1315).
36
+
37
+
##### Copy of workflows
38
+
39
+
Forms allows you to make a copy of a form to use as a starting point for a new one. You can choose whether or not to copy workflows along with the form. With the 13.4 release, we've made available a second dialog allowing you to copy workflows to an existing form [#1185](https://github.com/umbraco/Umbraco.Forms.Issues/issues/1185). You can select any or all of the workflows on the current form and copy them to the selected destination form.
40
+
41
+
We've also resolved an edge case around copying a form. It's possible to [define workflows as mandatory](./developer/extending/customize-default-workflows.md#setting-a-mandatory-default-workflow). Copying the form without workflows excludes the desired workflow. You would have a form that didn't contain the workflow you wanted to be included on all. This has been tightened up now and mandatory workflows will always be assigned to the copied form [#1331](https://github.com/umbraco/Umbraco.Forms.Issues/issues/1331).
42
+
43
+
##### Form picker enhancements
44
+
45
+
In the 14.2 release we enhanced the [form picker property editors](./developer/property-editors.md). We introduced support for restriction of which forms can be selected by folder rather than only by individual forms. This has now been backported to Forms 13 [#891](https://github.com/umbraco/Umbraco.Forms.Issues/issues/891).
46
+
47
+
##### File upload validation messages
48
+
49
+
Previously the validation messages presented on the website front end when uploading files were hardcoded and always provided in English. We've added settings now to the "File Upload" field type allowing you to customize these. Dictionary keys can be used in order to provide the information in the user's preferred language [#1327](https://github.com/umbraco/Umbraco.Forms.Issues/issues/1327).
* Fixed regression introduced in 13.3.1 that caused issues for custom field types overriding the `ProcessSubmittedValue` method [#1328](https://github.com/umbraco/Umbraco.Forms.Issues/issues/1328).
@@ -446,6 +447,15 @@ This setting determines whether [multi-page form settings](../../editor/creating
446
447
447
448
By default the value is `true`. To disable the feature, set the value to `false`.
448
449
450
+
## EnableAdvancedValidationRules
451
+
452
+
This setting determines whether [advanced form validation rules](../../editor/creating-a-form/form-advanced.md) are available to editors.
453
+
454
+
By default, the value is `false`. This is partly because the feature is only considered for "power users", comfortable with crafting rules using the required JSON syntax. And partly as validating the rules on the client requires an additional front-end dependency.
455
+
456
+
To make the feature available to editors and include the dependency when using `@Html.RenderUmbracoFormDependencies(Url)`, set the value to `true`.
In this article, you will find information about accessing the Forms Advanced Options and the features available to customize your Form.
4
+
5
+
To access the Form Advanced Options:
6
+
7
+
1. Navigate to the **Forms** section.
8
+
2. Open a Form you wish to customize.
9
+
3. Click **Advanced** in the top-right corner of the screen.
10
+
11
+
{% hint style="info" %}
12
+
The advanced options for forms are only available when [configured to display](../../developer/configuration/README.md#enableadvancedvalidationrules).
13
+
{% endhint %}
14
+
15
+
## Validation Rules
16
+
17
+
When creating forms you can add validation to individual fields, making them mandatory or applying a regular expression pattern. You can provide validation rules for the entire form via the advanced options. This allows you to validate expressions based on multiple fields. For example, "these two email fields should be the same", or "this date should be after this other one".
To add new rules, you need to provide the rule definition, an error message and select a field to which the message will be associated. Once created you can click to edit or delete them from the list.
22
+
23
+
Crafting the rule definition itself requires use of [JSON logic](https://jsonlogic.com/) along with placeholders for the field or fields that are being validated.
24
+
25
+
### Examples
26
+
27
+
One example use case would be ensuring that two fields match each other, perhaps when asking for a user's email address. Given two fields on the form, one with the alias of `email` and the other `compareEmail`, the rule would be:
28
+
29
+
```json
30
+
{
31
+
"==": [
32
+
"{email}",
33
+
"{compareEmail}"
34
+
]
35
+
}
36
+
```
37
+
38
+
A slightly more complex example could be with two dates, where, if provided, you want to ensure the second date is later than the first. So given fields with aliases of `startDate` and `endDate` a rule would look like this:
39
+
40
+
```json
41
+
{
42
+
"or": [
43
+
{
44
+
"==": [
45
+
"{startDate}",
46
+
""
47
+
]
48
+
},
49
+
{
50
+
"==": [
51
+
"{endDate}",
52
+
""
53
+
]
54
+
},
55
+
{
56
+
">": [
57
+
"{endDate}",
58
+
"{startDate}"
59
+
]
60
+
}
61
+
]
62
+
}
63
+
```
64
+
65
+
Rules can be nested too. In this final illustrative example, we have two fields. One with the alias `choose` is a drop-down list with two values: `A` and `B`. The second field with alias `test` we want to be completed only if the user selects `B`. So we create a rule that is valid only if A is selected OR B is selected AND `test` is completed.
66
+
67
+
```json
68
+
{
69
+
"or": [
70
+
{
71
+
"==": [
72
+
"{choose}",
73
+
"A"
74
+
]
75
+
},
76
+
{
77
+
"and": [
78
+
{
79
+
"==": [
80
+
"{choose}",
81
+
"B"
82
+
]
83
+
},
84
+
{
85
+
"!=": [
86
+
"{test}",
87
+
""
88
+
]
89
+
}
90
+
]
91
+
}
92
+
]
93
+
}
94
+
```
95
+
96
+
Overall, you can create rules of varying complexity, using comparisons between fields and static values.
97
+
98
+
When the form is rendered, these validation rules will be applied on both the client and server-side. In this way, you can ensure the submission is only accepted if it meets the requirements.
0 commit comments