Hi Bob,
Yes you are correct, I did not notice that because I was not using any of the standard resource fields in my form. Also, I noticed with the way I set it up, the TVs were not showing their default value.
So my new solution was to not use the code that kctechsoln provided but just to modify the newspublisher.class.php in a couple of places. First I replaced my change above and replaced it with this (line 1213):
if (!$this->existing) {
$presetValue = $this->props[$name . '_value'];
if ($presetValue) {
$this->modx->toPlaceholder($name, $presetValue, $this->prefix );
} else {
$this->modx->toPlaceholder($name, $ph, $this->prefix );
}
} else {
$this->modx->toPlaceholder($name, $ph, $this->prefix );
}
I also changed the displaySimple function (line 1527) by adding the same above code in order to make the pre-setting of the standard resource fields work:
protected function _displaySimple($name, $tplName, $maxLength = 10) {
if (!$this->existing) {
$presetValue = $this->props[$name . '_value'];
if ($presetValue) {
$this->modx->toPlaceholder($name, $presetValue, $this->prefix );
} else {
$this->modx->toPlaceholder($name, $ph, $this->prefix );
}
} else {
$this->modx->toPlaceholder($name, $ph, $this->prefix );
}
$PHs = array('[[+npx.maxlength]]' => $maxLength);
return $this->strReplaceAssoc($PHs, $this->getTpl($tplName));
}
Now it only adds the pre-set value when creating the form for a new resource. Also, I made my Newspublisher snippet properties slightly different then kctechsoln, instead of "Value" added after the field name I am using "_value" like so:
[[!NewsPublisher?
...
&show=`pagetitle,mytv,usernametv`
&pagetitle_value=`Pre-set Page Title`
&mytv_value=`Pre-set Template Variable Value`
&usernametv_value=`[[!+modx.user.id:userinfo=`fullname`]]`
...
]]
Hopefully this might help someone else and thank you Bob.