Event Object Actions

This page introduces the actions you can perform on the event object.

Overwrite field values

If the event handler overwrites values in the fields of the record object and returns the event object, the fields of the record are updated with those values in the object.

If the action overrides the value in the same field, the action takes precedence.

If you want to perform a specific action, prepare the field values of the record object that matches the operating conditions and return the event object.

Sample
((APP_ID) => {
	"use strict";
	pd.event.on(APP_ID, 'pd.change.field_1_', (event) => {
		const record = event.record;
		if (record.field_1_.value=='')
		{
			record.field_2_.value=='option1';
		}
		return event;
	});
})(pd.APP_ID);

Run Lookup fields

If the event handler enters true to the lookup property of the lookup field and returns an event object, it will automatically retrieve those lookup fields.

To clear the lookup field, empty the value property and enter true for the lookup property.

Sample
((APP_ID) => {
	"use strict";
	pd.event.on(APP_ID, 'pd.edit.load', (event) => {
		const record = event.record;
		if (!record.field_3_.value)
		{
			record.field_3_.value=1;
			record.field_3_.lookup=true;
		}
		return event;
	});
})(pd.APP_ID);

Stop subsequent processing

If the event handler inputs true to the error property and returns an event object, the operation involving subsequent processing is cancelled.

Sample
((APP_ID) => {
	"use strict";
	pd.event.on(APP_ID, 'pd.create.submit', (event) => {
		const record = event.record;
		if (record.field_1_.value=='')
		{
			pd.alert('No value entered.');
			event.error=true;
		}
		return event;
	});
})(pd.APP_ID);

Disable field editing or hide the field itself

kumaneko comes standard with action features that disable field editing or hide the field itself.

You can specify the operating conditions for these actions, so if you want to perform these actions through an event object, prepare the field values of the record object that matches the operating conditions and return the event object.