OnDocFormRender
Last updated Oct 14th, 2026 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moreEvent: OnDocFormRender¶
Fires after a Resource editing form is loaded in the Manager. Use it to insert HTML straight into the form.
- Service: 1 - Parser Service Events
- Group: Resources
Event Parameters¶
| Name | Description |
|---|---|
| mode | Either new or upd (modSystemEvent::MODE_NEW / MODE_UPD). |
| id | The ID of the Resource. This will be 0 for new Resources. |
| resource | A reference to the modResource object. Since 2.4 an empty object for new Resources; before 2.4 null. |
Setting Default Resource Values¶
Since Revolution 2.4.0, a plugin on OnDocFormRender can set a value for one of the following fields:
pagetitlelongtitledescriptionintrotextcontentlink_attributesaliasmenutitle
Do this only on new Resources: on existing ones, the values you set will override the current ones.
$eventName = $modx->event->name;
switch($eventName) {
case 'OnDocFormRender':
if ($mode == modSystemEvent::MODE_NEW) {
// set default values
$resource->set('pagetitle', 'Heading');
$resource->set('description', 'Description');
$resource->set('content', 'Content');
}
break;
}
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










