Page 1 of 1
Change color of field based on another fields value
Posted: 30 Apr 2018
by Jaydius
I have one field that has color choices (Red, Green). Based on the choice in this field, how can I change the background color of another field to the color selected?
Re: Change color of field based on another fields value
Posted: 01 May 2018
by Nikita Kurguzov
Dear Jaydius,
That should be doable, but it depends on what type of field you want to change background of. Do you want the background to save or be only visible when the form is opened?
Re: Change color of field based on another fields value
Posted: 04 May 2018
by Jaydius
Just wanting to change the background of a standard text field. Ideally showing on 'View' and 'Edit' forms.
Re: Change color of field based on another fields value
Posted: 04 May 2018
by Nikita Kurguzov
Dear Jaydius,
For standard text field, you can use the following code on Edit form to change background color:
Code: Select all
fd.field('Title').control()._el().find('input').attr('style', 'background-color: #EE5050;')
For Display Form, use the following code:
Code: Select all
var style = fd.field('Title').control()._el().attr('style');
fd.field('Title').control()._el().attr('style', 'background-color: #EE5050;' + style);
How to detect change in Choice field, you can find in the following article -
https://spform.com/javascript-framework ... eld-values
Re: Change color of field based on another fields value
Posted: 07 May 2018
by Jaydius
Thank you Nikita, works perfectly! Really appreciate your help.