Hello
Anyone can pls provide me with a sample code, whereby if I change a field value in a web form (from a drop-down list for example), the value shown in another field is automatically updated to show the needed value for that selected option?

try this:
and change according to your requirement.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
function changeValue(x)
{
	var divEls = document.getElementsByTagName("div");
	var i = 0;
	
	for(i=0;i<divEls.length;i++)
	{
	divID=divEls[i].id;
	//alert(divID);
	//alert(x);
	if(divID == x)
		document.getElementById(divID).style.visibility = "visible";
	else
		document.getElementById(divID).style.visibility = "hidden";
	}
}
</script>
</head>
<body>
<select name="htmlcombo" id="htmlcombo" onChange="changeValue(this.value);">
 <option  value="0">Select</option>
    <option  value="1">Display Text1</option>
    <option  value="2">Display Text2</option>
    <option  value="3">Display Text3</option>
</select>

<div id="1" style="visibility:hidden" >hello1</div>
<div id="2" style="visibility:hidden">hello2</div>
<div id="3" style="visibility:hidden">hello3</div>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.