wood burning stoves 2.0*
The moose likes Struts and the fly likes Hiding form field labels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Hiding form field labels" Watch "Hiding form field labels" New topic
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: 94

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hiding form field labels
 
Similar Threads
Words that differ by one letter
how to add values to servlet and call that servlet
WA #2 ..... word association
validation.xml NullPointerException
Value from select element is null in request