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

Disabling className removes default class form-control #544

Closed
KuenzelIT opened this issue Jul 2, 2017 · 8 comments
Closed

Disabling className removes default class form-control #544

KuenzelIT opened this issue Jul 2, 2017 · 8 comments

Comments

@KuenzelIT
Copy link

Hey,

is it possible to disable (or rather hide) the className attribute but keep the default class form-control for every field?

Thanks!

@TranAudi
Copy link

TranAudi commented Jul 6, 2017

Did you solve the problem?
I also have problems like you :(

@KuenzelIT
Copy link
Author

I ignored this for now, but if I had to solve this right now, I would disable the className, catch the fieldAdded event and add the class form-control to every input which doesn't already have it.

@TranAudi
Copy link

I will try to make your way.
Thanks you 👍

@TranAudi
Copy link

I solved this problem as follows:

<style> .form-group.className-wrap, .form-group.name-wrap, .form-group.access-wrap, .form-group.value-wrap { display: none !important; } </style>

@KuenzelIT
Copy link
Author

Nice solution!

@rssluca
Copy link

rssluca commented Sep 5, 2017

Hi, I am looking for a cleaner solution as well. Is there a way to set the default class for fields?

@rssluca
Copy link

rssluca commented Sep 20, 2017

I resolved adding the attribute in the control file build call.

in controls/text.js

  build() {
    this.config['className'] ='form-control'; // Add this line
    return this.markup('input', null, this.config);
  }

in textarea.js

  build() {
    this.config['className'] ='form-control'; // Add this line
    let {value = '', ...attrs} = this.config;
    this.field = this.markup('textarea', this.parsedHtml(value), attrs);
    return this.field;
  }

@kevinchappell
Copy link
Owner

fixed in 2.10.0

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

4 participants