CodeCharge Studio

On Change event

Applies to

List Box, Text Area, Text Box

Description

This event occurs on the client side after the control's value is changed and focus is lost. It can be used to change values of other controls and for validation of input values.

Examples

The following is an example of a Celsius-to-Fahrenheit temperature converter. In a Record form called NewRecord1 with the text boxes TextBox1 and TextBox2, the Custom Code in the On Change event converts the Celsius value entered in Textbox1 to a Fahrenheit value which is displayed in Textbox2.

<script language="JavaScript">
function page_NewRecord1_TextBox1_OnChange()
{
var result;

     document.NewRecord1.TextBox2.value = ((9/5) * document.NewRecord1.TextBox1.value ) + 32;

  return result;
}

function bind_events() {
  check_and_bind('document.NewRecord1.TextBox1','onchange',page_NewRecord1_TextBox1_OnChange);
  forms_onload();
}

window.onload = bind_events;
</script>


On-line, printable versions and updates