Field Style not working on Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:23 AM - edited 10-25-2023 03:29 AM
Good Day,
I have created a style and it woks on the list but not on the form please help.
Field name: Truck
Field name: javascript:current.u_truck.u_fuel_type=='BEV';
Style: background-color:#71E279
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:30 AM
Hi @Michael_Nash ,
In order for it to work on form u need to write a onLoad Client Script. Please refer below as an example & modify accordingly.
function onLoad() {
//Type appropriate comment here, and begin script below
var eraststuscode = g_form.getControl('u_status');// replace it with ur backend name of the field
eraststuscode.style.backgroundColor = 'lightgreen';
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 04:48 AM
Hi @Danish Bhairag2 I have tried with the below code and its not working unless my script is incorrect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 05:12 AM
Hi @Michael_Nash ,
Can we try putting an alert on fuelType varaibel to check if we getting proper value?
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 05:19 AM