-
- 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, 8 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.
-
- 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.
-
- 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.
-
- 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.
-
- 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.
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.