We have a template that requires several Template Variables to be filled out, each is categorised so when adding a new document using the template they are put in the relevant category in the Template Variables tab. The issue we have is end users are not filling out required items and when saving they get the 'Please correct the errors in your form before submitting.'. The users then don't think to look through all the categories or in other tabs where information is required. Is there a way it can let them know which fields need data adding to them?
I think you can use Form Customization to put those TVs in the main tab. They should be outlined in red if left blank.
Possibly a better solution is to use NewsPublisher in the front end to create the resources. It will give much clearer error messages and you can omit fields and TVs the user doesn't need to fill from the form.
if (is_numeric($this->props['template'])) { /* user sent a number */
$t = $this->modx->getObject('modTemplate',
(integer) $this->props['template']);
/* make sure it exists */
if (! $t) {
$this->SetError($this->modx->lexicon('np_no_template_name') .
$this->props['template']);
}
} else { /* user sent a template name */
$t = $this->modx->getObject('modTemplate',
array(
'templatename' => $this->props['template']
));
if (!$t) {
$this->setError($this->modx->lexicon('np_no_template_name') .
$this->props['template']);
}
}
It just checks for either a Template with that name or a template with that ID number. Are you sure you have the name and ID correct?
Is the Template protected in any way (say with an Element Category Access ACL entry)?
I'm embarrassed to say it but I was adding in the snippet in the WYSIWYG editor and it was adding in tags that broke it. It is now working! My next hurdle will be to get it working with ImagePlus.