Change background-color cell onchange

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
thalassa3003
User
Posts: 62

Change background-color cell onchange

Post by thalassa3003 »

Hi,

I'm trying to change the background-color of a field when another field value changes on a edit page, but I cant seem to get the code right

$(document).ready(function(){

$("#x_nutrientTypeCode_1").change(function(){
	if($("#x_servingSizeUOM").val() =="") 
	$this->quantityContained_1->CellCssStyle = "background-color: #FF0000";
});

});

Can someone please help me out?

Thx!!


scs
User
Posts: 694

Post by scs »

thalassa3003 wrote:
$(document).ready(function(){ // no need

$("#x_nutrientTypeCode_1").change(function(){
	if($("#x_servingSizeUOM").val() =="") 
	$this->quantityContained_1->CellCssStyle = "background-color: #FF0000";
});

}); // no need

Create a class for this issue.

In client script -> table -> (add/copy|edit) page -> startup script
$("#x_nutrientTypeCode_1").change(function(){
if($("#x_servingSizeUOM").val() == "")
$("#x_quantityContained_1").css("background-color", "#FF0000");
}).triggerHandler('change');

Hope this help


Post Reply