-
-
Save michaelrwiley/a110f5384809b090b097d1af2b6c7660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
To be used as such: | |
import FormFunctions from 'form_funcs'; | |
FormFunctions.handleControlRegistration... etc. | |
*/ | |
module.exports = { | |
handleControlRegistration(obj, context) { | |
context.Apple = true; | |
if(!context.FromControlList) context.FromControlList = []; | |
context.FromControlList.push(obj); | |
}, | |
isFormValid(context) { | |
let formIsValid = true; | |
for(let i = 0; i < context.FromControlList.length; i++){ | |
let valid = context.FromControlList[i].ValidateFunction(); | |
if (valid === false) formIsValid = false; | |
} | |
return formIsValid; | |
}, | |
handleGetFormData(context) { | |
let postData = {}; | |
for (let i = 0; i < context.FromControlList.length; i++) { | |
let value = context.FromControlList[i].GetValue(); | |
postData[context.FromControlList[i].Name] = value; | |
} | |
return postData; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment