Custom scripts can be written in forms by writing events in “Client Script” / “Client Script Core” in the DocType. Some conventions for writing client scripts
See Examples
Sets value v in the field fn of the give dt and dn
This is the object that contains all Forms. The Form Container contains the page header and Form toolbar that is refreshed whenever a new record is shown.
Each doctype has a Frm object. When records are loaded on the Frm object, fields inside the form are refreshed
Dictionary of all sections by label. This can be used to switch to a particular section. Example:
cur_frm.set_section(cur_frm.sections_by_label['More Details'].sec_id);
Refresh the current form. It will
Will save the current record (function called from the “Save” button)
save_action can be Save, Submit, Cancel
the df attribute represents the Field data. Standard Field properties are
Example:
var field = cur_frm.fields_dict['first_name']
field.df.reqd = 1;
field.refresh();
The FromGrid Class inherits from the Grid class. The Grid class was designed to be a generic INPUT.
Grid Types
There are two type of Grids:
When the user clicks on an editable Grid cell, it adds an Field object of that particular column to the cell so that the user can edit the values inside the cell. This Field object is known as the template The template can be accessed by the get_field method