| Author |
Hiding form field labels
|
Sang Ts
Greenhorn
Joined: Oct 08, 2012
Posts: 4
|
|
|
In <s:textfield> tag how can we disable the label attribute associated with struts2 form fields? Is it possible?
|
 |
jatan bhavsar
Ranch Hand
Joined: Jul 23, 2008
Posts: 296
|
|
Hi,
What you are trying to achieve?
Regards
Jatan
|
 |
Sang Ts
Greenhorn
Joined: Oct 08, 2012
Posts: 4
|
|
Hi,
Thank you for the reply.
When adding a struts control say a text field to a form, even if we are not giving the Label attribute, a label column (a new TD ) is added for that label.
We want to avoid this Label auto generation. We want to give the Label of the control explicity, directly in HTML itself.
Actually we want to avoid the new TD generation, this may badly affect our layout and design.
When adding the following line in jsp page
<form id="frm">
<table>
<tr>
<td>
<s:textfield name="userName" ></s:textfield>
</td>
</tr>
<table>
</form>
it will renders as
<form id="frm">
<table>
<tr>
<td>
<label for="frm_userName" class="label"> </label>
</td>
<td>
<input type="text" name="userName" value="" id="frm_userName">
</td>
</tr>
<table>
</form>
Thanks
Sang
|
 |
Yogesh Lonkar
Ranch Hand
Joined: Jul 17, 2012
Posts: 82
|
|
according to what ever you coded here
<form id="frm">
<table>
<tr>
<td>
<s:textfield name="userName" ></s:textfield>
</td>
</tr>
<table>
</form>
will not generate any label for particular input field because you have not specified any lable="FooBar" for it and if it is generated it might be because some where some how you are setting Key for that element. it will have auto key if your using JQuery some where for that field
|
Learning some thing New Every Day
|
 |
Sang Ts
Greenhorn
Joined: Oct 08, 2012
Posts: 4
|
|
Hi,
Thank you for the reply.
When I added theme as "simple" in my form tag i got the textfield without extra column for label.
Thanks
Sang TS
|
 |
 |
|
|
subject: Hiding form field labels
|
|
|