how to assign a class name to a created text field in mendix?

0
I have created one text field where I have to assign a class name for it, when I am double clicking on text field in modular its showing me a dialogue box, there we have class option. If I am giving there its assigning to its div not directly to text box.   How it is possible??
asked
2 answers
3

Hi Amresh,

 

This is intended behavior by Mendix. the "text field" in the modeler should not be read as an actual input field but as a widget. Every widget in Mendix is usually a <div> wrapper around visual elements (like in your case, an <input> textbox).

 

If you want to manipulate specific elements inside a widget you will have to change the stylesheet based on this setup, e.g.

.yourclass input {

     display: "none";

}

 

answered
1

Hi Amresh,

This is working as intended. If you want to specifically target your input field, you will have to create a class yourself. I am not sure how familiar you are with SASS (this Mendix7 how-to is a good start, shows which programs you need and such: https://docs.mendix.com/howto/guis/create-a-custom-theme-with-the-mendix-ui-framework, also helpful is this blogpost: http://www.mxblog.nl/2016/03/using-sass-with-mendix/), but you can easily create a class that lets you alter the (for instance) input field, which would look like:

.testClass {
    input{
        color: red;
        }
}

Hope this is enough information to help you on your way!

 

EDIT: I see I took too long typing this answer, Joost's answer is of course correct as well. I'll leave my post here, as it contains some information to get you started :)

answered