" /> " /> "/>

Struts2 bootstrap width of a text field

1.1k Views Asked by At

I am trying to change the width of a <s:textfield> I created like this:

<s:textfield name="process.name" key="lbl.process.name" cssClass="col-sm-4"/>

but it turns out into:

<div class="form-group ">
   <label class="col-sm-3 control-label" for="ShowProcess_process_name" >
      Displayname        
   </label>    
   <div class="col-sm-9 controls">
      <input type="text" name="process.name" value="name" id="ShowProcess_process_name"class="form-control col-sm-4"/>
   </div>
</div>

but what I want is:

<div class="form-group ">
   <label class="col-sm-3 control-label" for="ShowProcess_process_name" >
      Displayname        
   </label>    
   <div class="col-sm-4 controls">
      <input type="text" name="process.name" value="name" id="ShowProcess_process_name"class="form-control"/>
   </div>
</div>

Does anyone know how to change the width via bootstrap?

1

There are 1 best solutions below

7
Aleksandr M On BEST ANSWER

The cssClass is for styling input itself. To style the element which wraps input use elementCssClass attribute instead of cssClass.

<s:textfield name="process.name" key="lbl.process.name" elementCssClass="col-sm-4" />