json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Field failing a condition is not being removed from the model #798

Closed parky128 closed 8 years ago

parky128 commented 8 years ago

I am making use of the condition property on a field, and have successfully got it to show\hide based on the value of another field in my model.

I am finding however, that the field remains in the model when I go to submit the form.

According to the docs, fields that get hidden in the DOM should be removed from the model (destroyStrategy=remove) but this does not seem to be the case for me.

I have also tried setting the destroyStrategy on the field like so:

{
    "key":"IIN",
    "title":"Issuer Identification Number (IIN)",
    "condition":"model.IPEBitMap !== 26",
    "destroyStrategy": "remove"
}

But this makes no difference.

Is this a known issue? Am I missing something obvious here?

I am on latest version also - 0.8.13

Thanks

Anthropic commented 8 years ago

Can you try using the version of the bootstrap decorator from the bootstrap repo and let me know if the problem persists?

parky128 commented 8 years ago

Hi, I did try this after coming across this post - http://stackoverflow.com/questions/32253453/angular-schema-form-destroystrategy-works-only-on-siblings-that-are-array-of-obj

The behaviour still persists however, any ideas? Thanks

Anthropic commented 8 years ago

Are you able to make a plunker to demonstrate?

parky128 commented 8 years ago

Ok, looks like I wasn't including the bootstrap decorator, the conditional field is now not being included as expected