jsonform
jsonform copied to clipboard
onSubmit-function not executed in the playground
I tried the following code in the playground (http://ulion.github.io/jsonform/playground/)
{
"schema": {
"name": {
"type": "string",
"title": "Name",
"required": true
}
},
"form": [
"name"
],
"onSubmit": function (errors, values) {
if (errors) {
alert("Errors" + JSON.stringify(errors, null, ' '));
}
else {
alert("No errors");
}
}
}
Running this code in an own HTML-file works with alerting an error-Message:
[
{
"uri": "urn:uuid:b36484d3-317d-4848-8511-512df317c225#/required",
"schemaUri": "http://json-schema.org/draft-03/hyper-schema#/properties/required",
"attribute": "type",
"message": "Instance is not a required type",
"details": [
"boolean"
]
}
]
Running it within the playground shows an error for the onSubmit
-part. Besides that, the onSubmit-code is not executed.
tried it in playground, no error found.
2015-04-28 16:42 GMT+08:00 Gitward [email protected]:
I tried the following code in the playground ( http://ulion.github.io/jsonform/playground/)
{ "schema": { "name": { "type": "string", "title": "Name", "required": true } }, "form": [ "name" ], "onSubmit": function (errors, values) { if (errors) { alert("Errors" + JSON.stringify(errors, null, ' ')); } else { alert("No errors"); } } }
Running this code in an own HTML-file works with alerting an error-Message:
[ { "uri": "urn:uuid:b36484d3-317d-4848-8511-512df317c225#/required", "schemaUri": "http://json-schema.org/draft-03/hyper-schema#/properties/required", "attribute": "type", "message": "Instance is not a required type", "details": [ "boolean" ] } ]
Running it within the playground shows an error for the onSubmit-part. Besides that, the onSubmit-code is not executed.
— Reply to this email directly or view it on GitHub https://github.com/ulion/jsonform/issues/9.
Ulion
I don't get the alert window as define in the onSubmit
. The only alert I get is:
And here is the error I get:
Don't you see that error? Do you get the alert-window defined in the onSubmit
?
no, I don't get it, but the error is just the editor alert it's not a valid JSON.
the reason which is not called maybe related it's in playground, in real code, it will be called. so you are saying the playground has bug which cause the onSubmit defined in the editor was not called?
2015-04-28 20:11 GMT+08:00 Gitward [email protected]:
I don't get the alert window as define in the onSubmit. The only alert I get is: [image: alert] https://cloud.githubusercontent.com/assets/8510849/7369161/b20bdb92-edaf-11e4-901b-32128a303a76.png
And here is the error I get: [image: error2] https://cloud.githubusercontent.com/assets/8510849/7369207/4d8bab88-edb0-11e4-9e17-2245d0cc4a51.png
Don't you see that error? Do you get the alert-window defined in the onSubmit?
— Reply to this email directly or view it on GitHub https://github.com/ulion/jsonform/issues/9#issuecomment-97038975.
Ulion
so you are saying the playground has bug which cause the onSubmit defined in the editor was not called?
Yes. But when you say this is intentional, than I'll close this ticket.