In this article we will see how the **onChange** event works, available in Scriptcase. It is triggered when the object, which makes use of it, has its value changed.

Down below is an example of using this event. We will use an order items form, we will use ajax on the form to capture the unit price of the product and calculate the total price based on the quantity of products desired.

1. First, let's configure the product field to display the product name at the location of the ID.

We must access the application settings, and select the field in question (productid).

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=k87ha5b658ec9d8c74d85942e706a19f1329f)

2. Next, we must change the type of the field to an **auto-complete number,** as it is of the type **number.**

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=k87ha39275e59a5304240bc830ac71942d40e)

3. Finally, we must configure the display lookup, using the products table to find the product names.

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=k87hafe67c564423d4a7f96dc69a49c148c89)

4. Next, we will create an ajax event (onChange) in the **productid** field, to find the unit price in the table when informing the product name.

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=k87haec9af5f3f63b4dec8651b8c3b6a59da8)

5. We will use the sc\_lookup macro ([For more information click here](https://www.scriptcase.net/docs/en_us/v9/manual/14-macros/02-macros/)) to search for this information in the database.

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=k87ha487988ac9277446e99855948c0559f24)

6. Next, we will create another ajax event (onChange), this time in the quantity field, to calculate the total value by informing the desired quantity.

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=k87hae0956e8742274566ac9019277ae11630)

7. Next, we can see the Ajax prcessing .