Skip to content

Commit 4d6748f

Browse files
committed
One-time bindings
1 parent 98e28f7 commit 4d6748f

8 files changed

+21
-20
lines changed

src/bootstrap/checkbox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
sf-field-model
88
schema-validate="form"
99
class="{{::form.fieldHtmlClass}}"
10-
name="{{form.key.slice(-1)[0]}}">
10+
name="{{::fieldId(true, false)}}">
1111
<span ng-bind-html="form.title"></span>
1212
</label>
1313
<div class="help-block" sf-message="form.description"></div>

src/bootstrap/checkboxes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
sf-changed="form"
1515
class="{{::form.fieldHtmlClass}}"
1616
ng-model="titleMapValues[$index]"
17-
name="{{form.key.slice(-1)[0]}}">
17+
name="{{::fieldId(true, false)}}">
1818
<span ng-bind-html="form.titleMap[$index].name"></span>
1919
</label>
2020

src/bootstrap/default.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="form-group {{::form.htmlClass}}"
22
ng-class="{ '{{'schema-form-' + form.type}}': true, 'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false }">
3-
<label class="control-label {{::form.labelHtmlClass}}" ng-class="{'sr-only': !showTitle()}" for="{{form.key.slice(-1)[0]}}">{{form.title}}</label>
3+
<label class="control-label {{::form.labelHtmlClass}}" ng-class="{'sr-only': !showTitle()}" for="{{::fieldId(true, false)}}">{{form.title}}</label>
44

55
<input ng-if="!form.fieldAddonLeft && !form.fieldAddonRight"
66
ng-show="::form.key"
@@ -9,12 +9,12 @@
99
sf-changed="form"
1010
placeholder="{{::form.placeholder}}"
1111
class="form-control {{::form.fieldHtmlClass}}"
12-
id="{{form.key.slice(-1)[0]}}"
12+
id="{{::fieldId(true, false)}}"
1313
sf-field-model
1414
ng-disabled="form.readonly"
1515
schema-validate="form"
16-
name="{{form.key.slice(-1)[0]}}"
17-
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}">
16+
name="{{::fieldId(true, false)}}"
17+
aria-describedby="{{::fieldId(true, true) + '-status'}}">
1818

1919
<div ng-if="form.fieldAddonLeft || form.fieldAddonRight"
2020
ng-class="{'input-group': (form.fieldAddonLeft || form.fieldAddonRight)}">
@@ -27,12 +27,12 @@
2727
sf-changed="form"
2828
placeholder="{{::form.placeholder}}"
2929
class="form-control {{::form.fieldHtmlClass}}"
30-
id="{{form.key.slice(-1)[0]}}"
30+
id="{{::fieldId(true, false)}}"
3131
sf-field-model
3232
ng-disabled="form.readonly"
3333
schema-validate="form"
34-
name="{{form.key.slice(-1)[0]}}"
35-
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}">
34+
name="{{::fieldId(true, false)}}"
35+
aria-describedby="{{::fieldId(true, true) + '-status'}}">
3636

3737
<span ng-if="form.fieldAddonRight"
3838
class="input-group-addon"
@@ -45,7 +45,7 @@
4545
aria-hidden="true"></span>
4646

4747
<span ng-if="hasError() || hasSuccess()"
48-
id="{{form.key.slice(-1)[0] + 'Status'}}"
48+
id="{{::fieldId(true, true) + '-status'}}"
4949
class="sr-only">{{ hasSuccess() ? '(success)' : '(error)' }}</span>
5050

5151
<div class="help-block" sf-message="form.description"></div>

src/bootstrap/radio-buttons.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
sf-field-model
1616
schema-validate="form"
1717
ng-value="item.value"
18-
name="{{form.key.join('.')}}">
18+
name="{{::fieldId(true)}}">
1919
<span ng-bind-html="item.name"></span>
2020
</label>
2121
</div>

src/bootstrap/radios-inline.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
ng-disabled="form.readonly"
1212
sf-field-model
1313
ng-value="item.value"
14-
name="{{form.key.join('.')}}">
14+
name="{{::fieldId(true)}}">
1515
<span ng-bind-html="item.name"></span>
1616
</label>
1717
</div>

src/bootstrap/radios.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
ng-disabled="form.readonly"
1111
sf-field-model
1212
ng-value="item.value"
13-
name="{{form.key.join('.')}}">
13+
name="{{::fieldId(true)}}">
1414
<span ng-bind-html="item.name"></span>
1515
</label>
1616
</div>

src/bootstrap/select.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<div class="form-group {{::form.htmlClass}} schema-form-select"
22
ng-class="{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}">
3-
<label class="control-label {{::form.labelHtmlClass}}" ng-show="showTitle()">
3+
<label class="control-label {{::form.labelHtmlClass}}" ng-show="showTitle()" for="{{::fieldId(true, false)}}">
44
{{form.title}}
55
</label>
66
<select sf-field-model
7+
id="{{::fieldId(true, false)}}"
78
ng-disabled="form.readonly"
89
sf-changed="form"
910
class="form-control {{::form.fieldHtmlClass}}"
1011
schema-validate="form"
1112
ng-options="item.value as item.name group by item.group for item in form.titleMap"
12-
name="{{form.key.slice(-1)[0]}}">
13+
name="{{::fieldId(true, false)}}">
1314
</select>
1415
<div class="help-block" sf-message="form.description"></div>
1516
</div>

src/bootstrap/textarea.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<div class="form-group has-feedback {{::form.htmlClass}} schema-form-textarea" ng-class="{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess()}">
2-
<label class="control-label {{::form.labelHtmlClass}}" ng-class="{'sr-only': !showTitle()}" for="{{form.key.slice(-1)[0]}}">{{form.title}}</label>
2+
<label class="control-label {{::form.labelHtmlClass}}" ng-class="{'sr-only': !showTitle()}" for="{{::fieldId(true, false)}}">{{form.title}}</label>
33

44
<textarea ng-if="!form.fieldAddonLeft && !form.fieldAddonRight"
55
class="form-control {{::form.fieldHtmlClass}}"
6-
id="{{form.key.slice(-1)[0]}}"
6+
id="{{::fieldId(true, false)}}"
77
sf-changed="form"
88
ng-attr-placeholder="{{::form.placeholder}}"
99
ng-disabled="form.readonly"
1010
sf-field-model
1111
schema-validate="form"
12-
name="{{form.key.slice(-1)[0]}}"></textarea>
12+
name="{{::fieldId(true, false)}}"></textarea>
1313

1414
<div ng-if="form.fieldAddonLeft || form.fieldAddonRight"
1515
ng-class="{'input-group': (form.fieldAddonLeft || form.fieldAddonRight)}">
1616
<span ng-if="form.fieldAddonLeft"
1717
class="input-group-addon"
1818
ng-bind-html="form.fieldAddonLeft"></span>
1919
<textarea class="form-control {{::form.fieldHtmlClass}}"
20-
id="{{form.key.slice(-1)[0]}}"
20+
id="{{::fieldId(true, false)}}"
2121
sf-changed="form"
2222
ng-attr-placeholder="{{::form.placeholder}}"
2323
ng-disabled="form.readonly"
2424
sf-field-model
2525
schema-validate="form"
26-
name="{{form.key.slice(-1)[0]}}"></textarea>
26+
name="{{::fieldId(true, false)}}"></textarea>
2727
<span ng-if="form.fieldAddonRight"
2828
class="input-group-addon"
2929
ng-bind-html="form.fieldAddonRight"></span>

0 commit comments

Comments
 (0)