We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20135
    • 188 Posts
    Hi, I've managed to navigate my way through Newspublisher to create an open q&a contact page, where my client can answer questions posted by the general public (I've still yet to go through the ACL implications for that one :S). However in testing, when I complete the form, the browser is redirected to new resource that NP creates, and what I want to do is remain on the form page and show success messages.

    How do I stop the redirect? If I ajax the POST request to another resource that has a NP snippet call on it, what do I put on that other resource so that it will return success and/or error messages for jquery to handle? I'm looking at BobRay here for some insight into what's possible to make NP work for me.

    Update: I found the &postId setting, which is great. That will redirect it to the page with the form. How can I send a success message? [ed. note: moniarde last edited this post 9 years, 7 months ago.]
    • Why are you using NewsPublisher for this? There are several form add-ons that would be more appropriate.

      Personally, I'd use ModxTalks. Yes, it's a commenting add-on, but with a little creative templating and configuration, it would be good for this feature.

      Even FormIt/Formit2DB would be good. You could use MigxDB to create a CMP backend application for your client to handle the user posts, as well as displaying the results if desired.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 20135
        • 188 Posts
        @sottwell: I thought about using FormIt - I think that I'll probably end up using that eventually, but I've had no experience with Formit2DB, and I figured that any option I pick that isn't dedicated to what I want to do is going to need significant persuading to do what I want. There's some other benefits to having the question added as a Resource too - I can use LikeDislike to add help rate the questions, and getResources can use that rating along with the creation date. Notify can send the client an email to let them know someone's posted, and the client can add their response to the resource directly, so that the question (introtext) and answer (content as richtext) can be managed within a single entity, not as separate rows in a grid. I did think about Quip (which I'm currently using with Articles elsewhere in the site), but couldn't see that I could combine both question and answer within the same entity.
          • 20135
          • 188 Posts
          Another question: how do I give the anonymous user new_document permissions in the web context? I've already applied the NewsPublisherEditor ACL to the context, but the user still doesn't have the right permissions according to NP.
            • 3749
            • 24,544 Posts
            Is the new document at the root of the tree? If so, they would also need new_document_in_root permission.

            I agree with Susan that some form of threaded discussion system might be a better option.

            If you're going to use NewsPublisher and you know there will only be one answer and no followups, you could make the answer a TV that would not be in the &show property on the NewsPublisher page the end user sees, but would be shown on the one the Client uses.

            The client could just edit the page with NP and fill in the answer and it should be easy to display questions and their answers.
              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
              • 20135
              • 188 Posts
              Quote from: BobRay at Sep 13, 2014, 08:58 PM
              Is the new document at the root of the tree? If so, they would also need new_document_in_root permission.

              I agree with Susan that some form of threaded discussion system might be a better option.

              If you're going to use NewsPublisher and you know there will only be one answer and no followups, you could make the answer a TV that would not be in the &show property on the NewsPublisher page the end user sees, but would be shown on the one the Client uses.

              The client could just edit the page with NP and fill in the answer and it should be easy to display questions and their answers.

              No, the new doc is not in the root.

              Your assumption there is correct - it's a simple 1 question/1 answer process. Further followups can be conducted by the client externally. The process you outlined above is exactly what I was thinking.

              I just don't know how I can get the form to display if the user is anonymous. Does the anonymous user need anything more in the NewsPublisherEditor ACL that would give it permission to view and submit the NP form?
                • 3749
                • 24,544 Posts
                It's something of a security risk to allow anyone at all to fill in a form that gets written to the database. That's why most Help Ticket systems require you to register and log in.

                I wouldn't do it, but if you're determined to let anonymous users create resources, I think creating a Context Access ACL entry for the Anonymous User group with a Context of 'web' and a Policy of NewsPublisherEditor might do it.



                  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
                • It would be safer for you to just use FormIt, and handle the storage yourself from the email you get. You could easily use a MIGx grid TV, and that would make it easier to output the questions and answers.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org