# HOW TO: set a border property on a field

**URL:** <https://forum.servoy.com/t/how-to-set-a-border-property-on-a-field/11791>\
**Category:** Classic Servoy\
**Created:** [February 17, 2010, 3:23pm UTC](https://forum.servoy.com/t/how-to-set-a-border-property-on-a-field/11791 "2010-02-17T15:23:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Providence1](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Providence1](https://forum.servoy.com/u/Providence1)\
**Post date:** [February 17, 2010, 3:23pm UTC](https://forum.servoy.com/t/how-to-set-a-border-property-on-a-field/11791/1 "2010-02-17T15:23:01Z")

</div>

This is for my own freaking edification because there is nothing on the forum and nothing in the documentation about how to do this and I have to search my own solution each time for the answer when it should be a simple google search away for everyone…

Three parameters should be defined when setting the border property to a field: the kind of border, the thickness, and the color.

These should be enclosed in quotes because they are passed as a string.

so…

```auto
element.setBorder.('LineBorder,1,#ff0000')

```

I’ve specified that the border of my field should be a line ( because really a border could could be any number of things: Etched, Line, SpecialMatte, etc) , it should have thickness of 1 (this can be done in whole integers) and it should have the color blood red because I like my near sighted and color blind users to know that there’s an issue with this field and that they haven’t done something correctly. (Users… who need 'em).

Oh, and if you want to set a border to empty ( I’ve read this should be done on an onShow but I’ve successfully tested it elsewhere), here’s how:

```auto
elements.setBorder("EmptyBorder,0,0,0,0")

```

Sardonic diatribe ends now…

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [February 17, 2010, 5:33pm UTC](https://forum.servoy.com/t/how-to-set-a-border-property-on-a-field/11791/2 "2010-02-17T17:33:41Z")

</div>

A suggestion to Paul Bakker: The exact syntax of all the types of borders should be in the wiki.

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [February 18, 2010, 9:14pm UTC](https://forum.servoy.com/t/how-to-set-a-border-property-on-a-field/11791/3 "2010-02-18T21:14:36Z")

</div>

In the mean time you can also find out the border format by setting format you want on a field using Servoy Developer and copy the string from the .frm-file.

```auto
borderType:"TitledBorder,Hello,2,2,DialogInput.plain,0,11,#0000ff"

```

Rob

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [March 6, 2010, 5:48pm UTC](https://forum.servoy.com/t/how-to-set-a-border-property-on-a-field/11791/4 "2010-03-06T17:48:13Z")

</div>

In Servoy 5.1, the code and sample helpers need work, too! The helper says:

> void setBorder(spec)

but when you copy the sample code, it presents the following example:

> var b = elements.elementName.setBorder(‘Line,1,1,#ccffcc’);

Note, one has an unknown return type and the other a return type of ‘void’.

Also, the sample helper show a specification of ‘Line,1,1,#ccffcc’ that does not work and should be ‘LineBorder,1,1,#ccffcc’.

I hope this helps!
