ok, sorry, it depends on where you put this code into your update-processor.
if you do it just before
$object->fromArray($postvalues);
it should look like this:
if (isset($postvalues['changealias']) && $postvalues['changealias'] == 'auto') {
$aliasresource = $modx->newObject('modResource');
$postvalues['alias'] = $aliasresource->cleanAlias($postvalues['model']);
}
$object->fromArray($postvalues);
I have another input-field 'alias' in my form where I can put an alias manually
for updating the alias, only when you have checked 'auto' or 'input' this can look like that in the update-processor:
if (isset($postvalues['changealias']) && $postvalues['changealias'] == '-') {
unset($postvalues['alias']);
}
if (isset($postvalues['changealias']) && $postvalues['changealias'] == 'auto') {
$aliasresource = $modx->newObject('modResource');
$postvalues['alias'] = $aliasresource->cleanAlias($postvalues['model']);
}
$object->fromArray($postvalues);
oh, and you don't need to have the field changealias in your table, its just a field in your form