Subject: RE: Customize Color Columns from Views on Web
Javascript would be used to change the property of the div.You can change any property you like… background color
For example, this snippet changes visibility:
//passthru html on the form (default value at launch)
//define two DIVS in css both start off hidden (display:none)
#div1 {display: none;}
#div2 {display: none;}
// define two areas on form (each area can be paragraphs) the tags are passthru html
area1
area2
//make a radio button field with values: “First”:“Second”
//fieldname (for this example) is ‘location’ (case is sensitive)
//in the ‘onchange’ event put this command
displaydivs();
//in the JSHeader (WEB) section put in the commands that do the work
function getSingleSelectText( selObj ) {
/* Gets field text, not value - handy utility code*/
return ( selObj.options[selObj.selectedIndex].text );
}
function displaydivs() {
var f = document.forms[0];
if ( getSingleSelectText(f.location) == “First” ) {
document.getElementById(‘div1’).style.display = ‘block’;
document.getElementById(‘div2’).style.display = ‘none’;
}
if ( getSingleSelectText(f.location) == “Second” ) {
document.getElementById(‘div1’).style.display = ‘none’;
document.getElementById(‘div2’).style.display = ‘block’;
}
}
The javascript runs ‘onchange’ that command checks the value of the location field and changes the style (in this example, the display) to ‘block’ or ‘none’
1st thing to decide upon is what style you want, here is how I’d start.
-
define the area with a div
-
set the default style of the div to what you want it to be changed to. This might take a bit of experimenting but since you’re doing it as default, for now, you can just make the change and display it to see how close you are to perfect
-
repeat this with all the areas you want to change
-
decide what state for each div would be default
-
decide how/when you want the change the divs… this example was w/radio ‘onchange’, but just as easily you could put it on something’s ‘onmouseover’ or whatever. Depending upon a field value isn’t your only option, but if it’s user driven then the code to get the field’s value is a bit different for multivalue/combobox/checkbox than I illustrated.