Extract of the form generated by $ ampersand gen form client/models/object.js:
module.exports = FormView.extend({
fields: function () {
return [
new InputView({
label: "Abbreviation",
name: "abbreviation",
value: this.model.abbreviation || "",
required: false,
placeholder: "Abbreviation",
parent: this
}),
new InputView({
label: "Description",
name: "description",
value: this.model.description || "",
required: false,
placeholder: "Description",
parent: this
}),
Both InputView have required: false, while the first one should have been required: true.
The input template is located at lib/templates/input.js and contains the following:
required: {{{ required }}},
Meaning that the value "false" is not hardcoded. Investigating further, the value of the required variable seems to be determined in lib/gen-types/form.js:
required: !!definition.required,
That's about as far as I get with my current understanding of Ampersand.js. Does anyone have an idea what's going wrong in this case?
Extract of a model called "object":
Extract of the form generated by
$ ampersand gen form client/models/object.js
:Both
InputView
haverequired: false
, while the first one should have beenrequired: true
.The input template is located at
lib/templates/input.js
and contains the following:Meaning that the value "false" is not hardcoded. Investigating further, the value of the
required
variable seems to be determined in lib/gen-types/form.js:That's about as far as I get with my current understanding of Ampersand.js. Does anyone have an idea what's going wrong in this case?