efleming969/form2object — Issue #2: Convenience methods/implementation
Author: sumtraveller
Created: 2011-12-30 02:04:45+00:00
State: open

I don't want to spend a bunch of time on form2Object but ....

var propCmd = sll.utils.formToObject(formEl);
var propCmd2 = new Form2Object().parse($(formEl)[0]);
var propCmd3 = new Form2Object().parse(document.getElementById(formEl));
var propCmd4 = new Form2Object(formId);

I'd like the 4th usage as it most closely approximates the terse convenience of the original.

If you would add this:

function Form2Object(formEl, customProcess) {
if(formEl){
return this.parseEl(formEl, customProcess);
}
}

Form2Object.prototype.parseEl = function(formEl, customProcess){
return this.parse(document.getElementById(formEl), customProcess);
};