andrewhathaway / Winterfell

Generate complex, validated and extendable JSON-based forms in React.
http://winterfell.andrewhathaway.net
MIT License
785 stars 116 forks source link

While submitting #36

Closed vijaya09 closed 9 years ago

vijaya09 commented 9 years ago

While trying to submit the form we are unable to do that. We got the following issue.

Uncaught Error: Winterfell: Attempted to validate for undefined method "undefined"

image

andrewhathaway commented 9 years ago

Hi there @vijaya09.

With the schema in the right I don't see any issues, however it may be an issue with the other part of the schema. Can you post the rest of your schema in PasteBin or something?

vijaya09 commented 9 years ago

Thanks for your response @andrewhathaway.

Please find the complete schema below.

Thanks,

module.exports = { "classes" : { "form" : "login-form", "input" : "form-control", "controlButton" : "btn btn-primary pull-right", "errorMessage" : "alert alert-danger", "buttonBar" : "button-bar" }, "formPanels" : [{ "index" : 1, "panelId" : "register-panel" }], "questionPanels" : [{ "panelId" : "register-panel", "panelHeader" : "Task List", "panelText" : "Please enter following details.", "action" : { "default" : { "action" : "SUBMIT", "target" : "http://google.com" } }, "button" : { "text" : "Submit" }, "questionSets" : [{ "index" : 1, "questionSetId" : "register-set" }] }], "questionSets" : [{ "questionSetId" : "register-set", "questions" : [{ "questionId" : "task-ID", "question" : "Task ID", "input" : { "type" : "textInput", "placeholder" : "Task ID 0000", "required" : true }, //Check if entry is a number and doesn't accept special characters "validations" : [{ "type" : "isInt", }, //Task ID exactly 4 characters { "type" : 'isLength', "params" : [4,4] }] }, { "questionId" : "task-name", "question" : "Task Name", "input" : { "type" : "textInput", "placeholder" : "Task Name" }, "validations" : [{ "type" : "isLength", "params" : [1,50] }] }, { "questionId" : "time-to-complete", "question" : "Time to Complete", "input" : { "type" : "radioOptionsInput", "options" : [{ "text" : "0-15 Minutes", "value" : "1" }, { "text" : "16-30 Minutes", "value" : "2" }, { "text" : "31-45 Minutes", "value" : "3" }, { "text" : "46-60 Minutes", "value" : "4" }, { "text" : "1+ Hour", "value" : "5" }] }, "validations" : [{ "type" : "isIn", "params" : [ [1, 2, 3, 4, 5] ] }] },{ "questionId" : "description", "question" : "Description", "input" : { "type" : "textareaInput", "placeholder" : "Describe Task" } },{ "questionId" : "start date", "question" : "Date", "input" : { "type" : "textInput", "placeholder" : "MM/DD/YYYY" }, // Make sure date is entered "validations" : [{ "type" : "isDate", "matches" : "(mmddyyyy, 'mm/dd/yyyy' )" }] },{ "questionId" : "email", "question" : "E-mail ID", "input" : { "type" : "emailInput", "placeholder" : "foo@example.com", "required" : true }, // Make sure email is entered "validations" : [{ "type" : "isEmail" }] },{ "questionId" : "password", "question" : "Password", "input" : { "type" : "passwordInput", "placeholder" : "8 characters minimum", "required" : true }, // Make sure password is entered "validations" : [{ "type" : "isLength", "params" : [1] }] },{ "questionId" : "passwordConfirm", "question" : "Password Confirm", "input" : { "type" : "passwordInput", "placeholder" : "confirm password" }, "validations" :[{ "type" : "equals", "params" : ["{password}"] //"matches" : "({passwordConfirm}, {password} )" //"message" : "Confirm password must match password field" }] },{ "questionId" : "status", "question" : "Status", "input" : { "type" : "radioOptionsInput", "options" : [{ "text" : "Done", "value" : "1", "conditionalQuestions" : [{ "questionId" : "doneLabel", "question" : "Heyyyy!! you are done!!", "input" : { "type" : "radioOptionsInput" }, "validations" : [{ "params" : ["yes"] }] }] },{ "text" : "In Progress", "value" : "2", "conditionalQuestions" : [{ "questionId" : "progressLabel", "question" : "Why aren't you done at!!", "input" : { "type" : "radioOptionsInput" }, "validations" : [{ "params" : ["yes"] }] }] }] }, "validations" : [{ "type" : "isIn", "params" : [ [1, 2] ] }] }] }] };

vijaya09 commented 9 years ago

@andrewhathaway

In the same schema that I have posted, I have another issue regarding the password confirmation. Even if I am giving the same password in both password and confirm password fields it is not validating. Could you please let me know if there is any problem with the schema.

screen shot 2015-09-29 at 9 39 54 am

Thanks,

andrewhathaway commented 9 years ago

Hi there. It would have been much better if you posted the schema in PasteBin, like I mentioned. Also, check #34.

Thanks.

andrewhathaway commented 9 years ago

Also @vijaya09.

The issue with your validation methods not working is where you have not specified a type property for one of your validation sets, lower down the schema.

vijaya09 commented 9 years ago

Hi @andrewhathaway

Please find the link below

http://pastebin.com/62R64QTq

Thanks,

vijaya09 commented 9 years ago

Hi there @andrewhathaway

Submit button worked.. Thank you..