mirror of https://github.com/status-im/consul.git
Validate all the things, all the time
This commit is contained in:
parent
ee3a32d771
commit
f4218b4bea
|
@ -40,6 +40,7 @@ export default Controller.extend({
|
||||||
// normalize back to standard event
|
// normalize back to standard event
|
||||||
const target = e.target || { ..._target, ...{ name: e, value: value } };
|
const target = e.target || { ..._target, ...{ name: e, value: value } };
|
||||||
switch (target.name) {
|
switch (target.name) {
|
||||||
|
case 'Description':
|
||||||
case 'Action':
|
case 'Action':
|
||||||
set(this.changeset, target.name, target.value);
|
set(this.changeset, target.name, target.value);
|
||||||
break;
|
break;
|
||||||
|
@ -60,6 +61,7 @@ export default Controller.extend({
|
||||||
set(this, target.name, selected);
|
set(this, target.name, selected);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this.changeset.validate();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,13 +50,13 @@
|
||||||
</div>
|
</div>
|
||||||
<label class="type-text{{if item.error.Description ' has-error'}}">
|
<label class="type-text{{if item.error.Description ' has-error'}}">
|
||||||
<span>Description</span>
|
<span>Description</span>
|
||||||
{{input value=item.Description name='description' placeholder="Description"}}
|
<input type="text" name="Description" value="{{item.Description}}" placeholder="Description" onchange={{action 'change'}} />
|
||||||
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
|
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div>
|
<div>
|
||||||
{{#if create }}
|
{{#if create }}
|
||||||
<button type="submit" {{ action "create" item}} disabled={{if item.isInvalid 'disabled'}}>Save</button>
|
<button type="submit" {{ action "create" item}} disabled={{if (or item.isPristine item.isInvalid) 'disabled'}}>Save</button>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<button type="submit" {{ action "update" item}} disabled={{if item.isInvalid 'disabled'}}>Save</button>
|
<button type="submit" {{ action "update" item}} disabled={{if item.isInvalid 'disabled'}}>Save</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
Loading…
Reference in New Issue