openmct/platform/forms/res/templates/form.html
Victor Woeltjen 354327accc [Forms] Support patterns
Support patterns for text fields, using the ng-pattern
directive. WTD-530.
2014-11-28 14:08:33 -08:00

55 lines
2.3 KiB
HTML

<form name="mctForm" novalidate>
<div class="form">
<span ng-repeat="section in structure.sections">
<div class="section-header" ng-if="section.name">
{{section.name}}
</div>
<div class="form-section">
<ng-form name="mctFormInner" ng-repeat="row in section.rows">
<div class="form-row validates"
ng-class="{
req: row.required,
valid: mctFormInner.$dirty && mctFormInner.$valid,
invalid: mctFormInner.$dirty && !mctFormInner.$valid
}">
<div class='label' title="{{row.description}}">
{{row.name}}
<span ng-if="row.description"
class="ui-symbol">
i
</span>
</div>
<div class='controls'>
<div class="wrapper" ng-if="row.control">
<mct-control key="row.control"
ng-model="ngModel"
ng-required="row.required"
ng-pattern="getRegExp(row.pattern)"
options="row.options"
structure="row"
field="row.key">
</mct-control>
</div>
<div ng-repeat="item in row.items" class="validates">
<ng-form name="mctFormItem">
<mct-control key="item.control"
ng-model="ngModel"
ng-required="item.required"
ng-pattern="getRegExp(item.pattern)"
options="item.options"
structure="row"
field="item.key">
</mct-control>
{{item.name}}
</ng-form>
</div>
</div>
</div>
</ng-form>
</div>
</span>
</div>
</form>