Expand my Community achievements bar.

Setting border

Avatar

Level 6
Hi,



Is it possible to set programatically the border of a field, just the bottom border, and not all the border (top, right and left).



Thank you!
4 Replies

Avatar

Former Community Member
I'm sure it's possible, but you can do that in Designer in the Border tab of Object properties.

Avatar

Level 6
Try this approach:

TextField1.border.getElement("edge",2).setAttribute("dashed","stroke");



The index number of the edge determines which one you're dealing with. Make sure you're using a dynamic form.



Jared Langdon

www.jlangdon.ca

Avatar

Level 6
Hi Langdon,



Thank you for your help, however, I couldn´t make it works. Nothing happens. Is it necessary to make a layout reload?



What I´m trying to acomplish is to print only a underline when the field was not filled. Another way would be to change the appearance of the field dynamically, for instance, from a sunked box to underlined and vice-versa (on the PrePrint and PostPrint). However, I don´t know hot to do this, also.



Thank you.

Avatar

Former Community Member
Try putting this script on the field(s) you want to add the border to. Put it in the exit event and select JavaScript.



if (this.rawValue == null)

t1.border.getElement("edge",2).setAttribute("dashed","stroke");



In this case, I've named the field t1.