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

Array-elements are deactivated within selectfieldsets #5

Closed
Gitward opened this issue Mar 11, 2015 · 3 comments
Closed

Array-elements are deactivated within selectfieldsets #5

Gitward opened this issue Mar 11, 2015 · 3 comments

Comments

@Gitward
Copy link

Gitward commented Mar 11, 2015

I added the following JSON Form object to http://ulion.github.io/jsonform/playground/

{
        schema: {
          name: {
            type: 'string',
            title: 'Name',
            required: true
          },
          age: {
            type: 'number',
            title: 'Age'
          },
          personality: {
            "type": "string",
            "title": "personality",
            "enum": ["active", "lazy"],
            "required": true,
            "default": "active"
          },
          hobbies: {
            type: 'array',
            "minItems": 2,
            "items": {
              "type": "object",
              "properties": {
                name: {
                  "type": "string",
                  "title": "Hobby",
                  "default": "Soccer"
                },
                since: {
                  "type": "string",
                  "title": "Active since",
                  "default": "2000"
                }
              }
            }
          }
        },
        "form": [
          "name",
          "age",
          {
            "type": "selectfieldset",
            "key": "personality",
            "title": "Personality",
            "items": [
              {
                "type": "fieldset",
                "htmlClass": "some-html-class",
                "title": "Your hobbies",
                "legend": "Enter your hobbies",
                "items": ["hobbies"]
              },
              {type: "fieldset", "legend": "Lazy people don't have hobbies"},
            ]
          }
        ],
        onSubmit: function (errors, values) {
          if (errors) {
            $('#res').html('<p>I beg your pardon?</p>');
          }
          else {
            $('#res').html('<p>Hello ' + values.name + '.' +
              (values.age ? '<br/>You are ' + values.age + '.' : '') +
              '</p>');
          }
        }
      }

Unfortunately, all array-elements but the first are deactivated:

ulion_1

Newly added elements are active after adding them:

ulion_2

But when changing personality from active to lazy and back to active, all array-elements but the first are deactivated:

ulion_3
ulion_4

This problem was already present from the commit 196486e The 'selectfieldset' field type may now be linked to a schema key. on

@ulion
Copy link
Owner

ulion commented Mar 11, 2015

thank you, will check the reason, though not so soon. and if you can figure
out how to fix it, please tell me or send a PR.

2015-03-12 0:51 GMT+08:00 Gitward notifications@github.com:

I added the following JSON Form Object to
http://ulion.github.io/jsonform/playground/

{
schema: {
name: {
type: 'string',
title: 'Name',
required: true
},
age: {
type: 'number',
title: 'Age'
},
personality: {
"type": "string",
"title": "personality",
"enum": ["active", "lazy"],
"required": true,
"default": "active"
},
hobbies: {
type: 'array',
"minItems": 2,
"items": {
"type": "object",
"properties": {
name: {
"type": "string",
"title": "Hobby",
"default": "Soccer"
},
since: {
"type": "string",
"title": "Active since",
"default": "2000"
}
}
}
}
},
"form": [
"name",
"age",
{
"type": "selectfieldset",
"key": "personality",
"title": "Personality",
"items": [
{
"type": "fieldset",
"htmlClass": "some-html-class",
"title": "Your hobbies",
"legend": "Enter your hobbies",
"items": ["hobbies"]
},
{type: "fieldset", "legend": "Lazy people don't have hobbies"},
]
}
],
onSubmit: function (errors, values) {
if (errors) {
$('#res').html('

I beg your pardon?

');
}
else {
$('#res').html('

Hello ' + values.name + '.' +
(values.age ? '
You are ' + values.age + '.' : '') +
'

');
}
}
}

Unfortunately, all array-elements but the first are deactivated:

[image: ulion_1]
https://cloud.githubusercontent.com/assets/8510849/6601589/d65044b6-c816-11e4-999a-3c52602e6542.png

Newly added elements are active after adding them:

[image: ulion_2]
https://cloud.githubusercontent.com/assets/8510849/6601617/f07a2f14-c816-11e4-891d-72e225126dbb.png

But when changing personality from active to lazy and back to active, all
array-elements but the first are deactivated:

[image: ulion_3]
https://cloud.githubusercontent.com/assets/8510849/6601648/228fdce2-c817-11e4-9b47-4a5ec1878e24.png
[image: ulion_4]
https://cloud.githubusercontent.com/assets/8510849/6601649/229c09ae-c817-11e4-9454-4326cd6bfd91.png

This problem was already present from the commit 196486e
196486e The
'selectfieldset' field type may now be linked to a schema key. on


Reply to this email directly or view it on GitHub
#5.

Ulion

sboekhoff added a commit to sboekhoff/jsonform that referenced this issue Mar 13, 2015
@ulion
Copy link
Owner

ulion commented Mar 13, 2015

Fixed, please confirm. you can test either on the playground:
http://ulion.github.io/jsonform/playground/
http://ulion.github.io/jsonform/playground/bootstrap3/

sboekhoff added a commit to sboekhoff/jsonform that referenced this issue Mar 23, 2015
This reverts commit c2591b3.
@Gitward
Copy link
Author

Gitward commented Apr 28, 2015

Now the array-elements are not deactivated anymore. Thanks.

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