AmpersandJS / ampersand

Quickest way to get started with ampersand.
MIT License
812 stars 41 forks source link

CLI-generated form doesn't keep the `type` attribute from the model #102

Open e2jk opened 9 years ago

e2jk commented 9 years ago

A model containing this props (extract):

        numberOfRecords: ['number', false, '']

generates the following form by calling $ ampersand gen form client/models/object.js (extract)

            new InputView({
                label: "Number Of Records",
                name: "numberOfRecords",
                value: this.model.numberOfRecords || "",
                required: false,
                placeholder: "Number Of Records",
                parent: this
            })

The dataType is defined as "number" in the model, the form needs a corresponding type: 'number'.

I suppose changes need to be done to lib/gen-types/form.js and lib/templates/input.js, please advise.