Skip to content

Commit

Permalink
#409 required fields in the JSON schema now get their required flags …
Browse files Browse the repository at this point in the history
…set on the input controls; to highlight missing values with a red border if the user doesn't enter them
  • Loading branch information
jstrachan committed Jul 25, 2013
1 parent 4cb2dd7 commit c075953
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hawtio-web/src/main/webapp/app/forms/js/baseDirectives.ts
Expand Up @@ -143,6 +143,10 @@ module Forms {
if (config.isReadOnly()) {
rc.attr('readonly', 'true');
}
var required = config.$attr["required"];
if (required && required !== "false") {
rc.attr('required', 'true');
}
return rc;
}
}
Expand Down
17 changes: 17 additions & 0 deletions hawtio-web/src/main/webapp/app/forms/js/simpleFormDirective.ts
Expand Up @@ -228,6 +228,23 @@ module Forms {
input.attr('entity', config.getEntity());
input.attr('mode', config.getMode());

// TODO check for id in the schema["required"] array too!
// as required can be specified either via either of these approaches
/*
var schema = {
required: ["foo", "bar"],
properties: {
something: {
required: true,
type: "string"
}
}
}
*/
if (property.required) {
input.attr('required', 'true');
}

var fullSchemaName = config.schemaName;
if (fullSchemaName) {
input.attr('schema', fullSchemaName);
Expand Down

0 comments on commit c075953

Please sign in to comment.