In latest SVN (and upcoming beta5), you can do so via the On*FormRender events. Those events will plug whatever you return straight into the form as HTML.
For example, this plugin code:
<?php
/**
* Register a form field to forms
*/
switch ($modx->event->name) {
case 'OnDocFormPrerender':
/* if you want to add custom scripts, css, etc, register them here */
break;
case 'OnDocFormRender':
$v = '';
if (isset($scriptProperties['resource'])) {
/* on the update screen, so set the value */
$v = 'saved value';
} else {
/* on the create screen, so set the default */
$v = 'default value';
}
/* now do the HTML */
$fields = '
<div class="x-form-item x-tab-item">
<label class="x-form-item-label">Home</label>
<div class="x-form-element">
<input type="text" name="home" value="'.$v.'" class="x-form-text x-form-field" />
</div>
</div>
';
$modx->event->output($fields);
break;
case 'OnDocFormSave':
/* do processing logic here. */
$resource =& $scriptProperties['resource'];
$resource->set('home',$_POST['home']);
$resource->save();
break;
}
return;
Note the CSS classes in the field HTML being returned; this is to get the styling to look nice with the ExtJS forms; however, you dont have to do this and can return them however you like.
This method will work with all the On*FormRender events.