We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51856
    • 3 Posts
    Hi

    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?

    Thanks

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      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.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 51856
        • 3 Posts
        Ah NewsPublisher does look as if it will do the job. It does not seem to be picking up the template though

        I've tried
        [[!NewsPublisher?
        &templateid=`profile`
        ]]
        and
        [[!NewsPublisher?
        &templateid=`3`
        ]]

        but on the page I get Failed to get template: `profile`..

        Do you have any ideas? I will keep looking, thanks!
          • 3749
          • 24,544 Posts
          The code for that is very straightforward:

          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)?

          You might also check the MODX error log.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • discuss.answer
            • 51856
            • 3 Posts
            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.

            Thanks for your help.