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
1.[Specific options and types](#specific-options-and-types)
19
19
1.[fieldset and section](#fieldset-and-section)
20
-
1.[conditional](#conditional)
21
20
1.[select and checkboxes](#select-and-checkboxes)
22
21
1.[actions](#actions)
23
22
1.[button](#button)
@@ -29,6 +28,7 @@ Documentation
29
28
1.[Post process function](#post-process-function)
30
29
1.[Events](#events)
31
30
1.[Manual field insertion](#manual-field-insertion)
31
+
1.[Deprecated fields](#deprecated-fields)
32
32
1.[Extending Schema Form](extending.md)
33
33
34
34
Basic Usage
@@ -208,7 +208,6 @@ Schema Form currently supports the following form field types out of the box:
208
208
|:--------------|:------------------------|
209
209
| fieldset | a fieldset with legend |
210
210
| section | just a div |
211
-
| conditional | a section with a ```ng-if``` |
212
211
| actions | horizontal button list, can only submit and buttons as items |
213
212
| text | input with type text |
214
213
| textarea | a textarea |
@@ -343,7 +342,8 @@ General options most field types can handle:
343
342
// and their items will inherit it.
344
343
htmlClass:"street foobar", // CSS Class(es) to be added to the container div
345
344
fieldHtmlClass:"street"// CSS Class(es) to be added to field input (or similar)
346
-
copyValueTo: ["address.street"] // Copy values to these schema keys.
345
+
copyValueTo: ["address.street"], // Copy values to these schema keys.
346
+
condition:"person.age < 18"// Show or hide field depending on an angular expression
347
347
}
348
348
```
349
349
@@ -461,7 +461,7 @@ See [Global Options](#global-options) for an example how you set entire form
461
461
to validate on blur.
462
462
463
463
### copyValueTo
464
-
This option has a very specific use case. Imagine you have the same option in several places, but you want them to be controlled from just one field. You specify what keys the value should be copied to, and the *viewValue* will be copied to these keys on the model. **Note: changing the model directly will not copy the value, it's intended for copying user input**. The recieving fields can be shown, but the intent for them is to be hidden.
464
+
This option has a very specific use case. Imagine you have the same option in several places, but you want them to be controlled from just one field. You specify what keys the value should be copied to, and the *viewValue* will be copied to these keys on the model. **Note: changing the model directly will not copy the value, it's intended for copying user input**. The recieving fields can be shown, but the intent for them is to be hidden.
465
465
466
466
Ex.
467
467
```javascript
@@ -471,29 +471,12 @@ Ex.
471
471
}
472
472
```
473
473
474
-
Specific options and types
475
-
--------------------------
476
-
477
-
### fieldset and section
474
+
### condition
475
+
The `condition` option lets you hide or show a field depending on an angular expression. Beneath
476
+
the surface it uses `ng-if` so the hidden field is *not* part of the form.
478
477
479
-
*fieldset* and *section* doesn't need a key. You can create generic groups with them.
480
-
They do need a list of ```items``` to have as children.
481
-
```javascript
482
-
{
483
-
type:"fieldset",
484
-
items: [
485
-
"name",
486
-
{ key:"surname", notitle:true }
487
-
]
488
-
}
489
-
```
490
-
491
-
### conditional
492
-
493
-
A *conditional* is exactly the same as a *section*, i.e. a `<div>` with other form elements in
494
-
it, hence they need an `items` property. They also need a `condition` which is
495
-
a string with an angular expression. If that expression evaluates as thruthy the *conditional*
496
-
will be rendered into the DOM otherwise not. The expression is evaluated in the parent scope of
478
+
`condition` should be a string with an angular expression. If that expression evaluates as thruthy
479
+
the field will be rendered into the DOM otherwise not. The expression is evaluated in the parent scope of
497
480
the `sf-schema` directive (the same as onClick on buttons) but with access to the current model
498
481
and current array index under the name `model` and `arrayIndex`. This is useful for hiding/showing
499
482
parts of a form depending on another form control.
0 commit comments