Make the outline of String field in Red

Abhi369
Tera Contributor

Hello Everyone,

 

I have a custom form in which I created one String field. I want to make the outline of the field as Red when the user enters the character in it more than it's limit. Is there any way we can configure this.

Please let me know.

 

Thank you,

Abhi

1 ACCEPTED SOLUTION

_Gaurav
Kilo Sage

Hi @Abhi369 
Please use the below code in your onChange client script for that specific field.

 

if(newValue.length>10)
{

var myField = 'short_description';
var ctrl = g_form.getControl(myField);
ctrl.style.borderColor = 'red';
}

Please refer to the snippet for a better understanding

_Gaurav_0-1709801845677.png

 

Please mark this as helpful and accept it as a solution if this works for you so that it would be helpful for others too.
Thanks!

View solution in original post

2 REPLIES 2

_Gaurav
Kilo Sage

Hi @Abhi369 
Please use the below code in your onChange client script for that specific field.

 

if(newValue.length>10)
{

var myField = 'short_description';
var ctrl = g_form.getControl(myField);
ctrl.style.borderColor = 'red';
}

Please refer to the snippet for a better understanding

_Gaurav_0-1709801845677.png

 

Please mark this as helpful and accept it as a solution if this works for you so that it would be helpful for others too.
Thanks!

shyamkumar VK
Kilo Patron

@Abhi369 , you need to design Client Script for this and It should be On Change of Short Description 

Make Isolate to False

var control = g_form.getControl('u_short_description');

	if(g_form.getValue('u_short_description').length>100){
		control.style.color = 'red'; // to set the color of field
	}
	else{
		control.style.color = ''; // clear it
	}

 Regards,

Shyamkumar

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar