Infosys Interview Question

What is a Client Script, and what are the different types of Client Scripts?

Interview Answer

Anonymous

Oct 27, 2025

A Client Script is a JavaScript code that runs on the client-side, typically in a user's web browser. It is triggered by specific client-side events, such as when a form is loaded, when a form is submitted, or when a field value is changed. Client Scripts allow you to enhance user interactions by executing custom logic in response to these events. There are four main types of Client Scripts: 1. OnLoad: Executes when the form is loaded in the browser. It is commonly used to set default values, modify the form layout, or hide/show fields. 2. OnSubmit: Runs when the form is submitted. It is used to validate form data or perform additional actions before the form is saved. 3. OnCellEdit: Triggers when a cell in a record is edited (typically in list-type forms). It allows you to perform actions based on the changes made to the data in the cell. 4. OnChange: Activates when the value of a field changes. This script is useful for dynamically updating other fields, performing validation, or applying conditional logic based on the new value.