Change background-color textentry field in a form | XM Community
Solved

Change background-color textentry field in a form

  • 17 September 2018
  • 6 replies
  • 48 views

Userlevel 3
Badge +5
Hello,

In a survey I build in a form like the below screenshot:
!

On the field Zipcode I added a validation on Postalcode. If a wrong code is given, a message appears. But I also want to have a different background-color. How can I set this background-color to a bit of red?

Thanks in advance.
icon

Best answer by LaT 17 September 2018, 14:20

View original

6 replies

Userlevel 7
Badge +33
Do you want to set it permanently red or become red only on wrong entry.
Userlevel 2
Badge +1
@Nico_Leussink ;

jQuery("[id='QR~"+this.questionId+"~4'] ").css({"background-color":"red"});
Userlevel 3
Badge +5
@bansalpeeyush29 : I would like to have it red when wrong and default color when correct. Is such possible?
Userlevel 7
Badge +33
Default you can set as per @LaT while on error it seems difficult.
Userlevel 7
Badge +33
You can have look at below code

https://www.oreilly.com/library/view/javascript-cookbook/9781449390211/ch14s04.html
Userlevel 3
Badge +5
Thank you all, this helped me a lot.

Leave a Reply