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

Name is overwritten by Id on model init #600

Closed
atarix83 opened this issue Nov 23, 2017 · 7 comments
Closed

Name is overwritten by Id on model init #600

atarix83 opened this issue Nov 23, 2017 · 7 comments

Comments

@atarix83
Copy link

Hi,

I would ask if there is some reason for that name is overwritten by Id value when a new instance of DynamicFormControlModel is created, or is a bug?
It would be useful sometimes to keep Id and name separated.

I paste the code line

Thanks

@udos86
Copy link
Owner

udos86 commented Nov 25, 2017

@atarix83 Hi Guiseppe!

I would ask if there is some reason for that name is overwritten by Id value when a new instance of DynamicFormControlModel is created, or is a bug?

It's not a bug, it's intentional. To a certain degree Angular forms rely on name attribute and I wanted to avoid any possible bugs due to naming differences between id and name.

It would be useful sometimes to keep Id and name separated.

Could you please point that out?

@atarix83
Copy link
Author

atarix83 commented Nov 27, 2017

Could you please point that out?

I have a forms that describe a resource with some metadata. My problem is that the key of metadata, that should be the form field's id, could contains a dot (e.g. "dc.title"). I would use the name to store the real metadata key because saving the key with dot into id generates an error.
At the moment my solution is to set the model name after the model has been instantiated.

@udos86
Copy link
Owner

udos86 commented Nov 27, 2017

@atarix83

Alright, I'll take it into consideration bringing this back!

BTW: This feature was removed in beta.1 :-)

@atarix83
Copy link
Author

@udos86 thank you so much!!

@1619digital
Copy link

Yes, this would be a very handy feature for the reasons @atarix83 mentioned.

Perhaps a low-risk solution would be for the html name attribute to render as the id if the name property on the control is null/empty/undefined. This would essentially make the behaviour stay the same, unless proactively set.

@udos86
Copy link
Owner

udos86 commented Dec 6, 2017

@atarix83 @PartyArk

Alright, this will be part of 5.1.2

@udos86 udos86 closed this as completed in cadd7e3 Dec 7, 2017
@ar27111994
Copy link
Contributor

Hi @udos86 @atarix83 , I'm still facing this issue, even though I am using the latest version 5.4.1 with Ionic UI. Please help.

bug1
bug2

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

No branches or pull requests

4 participants