backbone-forms
backbone-forms copied to clipboard
Existing form
A while ago, I started a fork of this rep to implement its features on existing form so it doesn't only generate forms but take existing ones and apply validation, plugins... (I can't really do a pull request as it was too long ago and it would be more complicated to merge than to rewrite the code).
Would you be interested in this feature? I'd be happy to write the code. It basically adds a el attribute - a jquery object or a selector - to the schema definition. So you can do any of this:
schema: {
name: $('#foo'),
email: '#email',
start: { el: $('#start') },
end: { el: '#start' }
}
It automatically detects what the input is and set the rest of the schema accordingly. Though it can be overwritten by being explicit in the schema definition.
Sounds interesting. I'm in the process of refactoring some of the code so could be worth waiting until that's done before starting on this.
Any ideas on what the API for this would look like?
What exactly do you want to know about the API?
I've done it 6 months ago (when you had one single file). I broke the file into AMD modules back then and you can look at some ideas for the config here: https://github.com/karellm/backbone-forms/blob/master/exemple/config.js
The code in the repo may be broken and isn't the latest version but it will give you an idea of what I wanted to do.
@powmedia Can you give me an update on this? How is the refactoring going?