Label Position

Tiago Gomes
Tera Contributor

Hi guys , 

I want to put a label on top off some field, like this image :

TiagoGomes_0-1681483519210.png

For this solution i change the "g_form.getLabel('teste').style="width=70%", but i have multiple fields, and i'm trying to find another way to do this.

Can anyone suggest some workaround? 

Thanks 

2 REPLIES 2

Mehta
Kilo Sage
Kilo Sage

You have to do this for each field. You can write a onload client script and have to use it for each field. 

Rahul Kumar17
Tera Guru

Hi Tiago,

 

One solution could be to use a separate HTML element to display the label above the field. You could use the HTML element 'label' and set its 'for' attribute to the 'id' of the input element. Here's an example code snippet:

HTML:

<label for="field1">Label Text</label>
<input type="text" id="field1" name="field1">

CSS:

label {
display: block;
width: 70%;
margin-bottom: 5px;
}

 

You can add as many 'label' elements as you need for different fields, and set their 'for' attribute to the corresponding 'id' of the input element. This way, the label will be associated with the field and clicking on it will focus on the input field.

Hope this helps!

 

Thanks,

Rahul Kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar