Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onSubmit-function not executed in the playground #9

Open
Gitward opened this issue Apr 28, 2015 · 4 comments
Open

onSubmit-function not executed in the playground #9

Gitward opened this issue Apr 28, 2015 · 4 comments

Comments

@Gitward
Copy link

Gitward commented Apr 28, 2015

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.

@ulion
Copy link
Owner

ulion commented Apr 28, 2015

tried it in playground, no error found.

2015-04-28 16:42 GMT+08:00 Gitward notifications@github.com:

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
#9.

Ulion

@Gitward
Copy link
Author

Gitward commented Apr 28, 2015

I don't get the alert window as define in the onSubmit. The only alert I get is:
alert

And here is the error I get:
error2

Don't you see that error? Do you get the alert-window defined in the onSubmit?

@ulion
Copy link
Owner

ulion commented Apr 28, 2015

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 notifications@github.com:

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
#9 (comment).

Ulion

@Gitward
Copy link
Author

Gitward commented Apr 28, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants