Forum
Getting data from form
Hello,
I was asked to create a job list page with the form underneath the page. I read through some forums and found out that this is possible but I could not figure out how to get the data submit from a form and display it as a content.
I hope you could help me with this.
Thank you!
The only option we have for UGC at the moment is the Comments app. That will give you a form that the user can fill in and the content can be redisplayed on the page.
Hi Drew,
I tried this earlier but I was having problems displaying the entries. I can see here that I can use a template but will I have to use perch:comments id values? or i can use perch:contents?
It would be
perch:comments
for the Comments app. The tags are namespaced to the app that processes them.Okay so how would I get the data from the form? can I use the id of the form? also how can I put an expiry on a comment?
You don't. The user creates a comment with a form. You moderate it. On your page, you then display the comment.
No, it's not connected to the form.
You'd need to filter the comments by date as you display them.
If that doesn't work for your use case then I don't have a solution, you'll have to build something with the API.
Hi Drew,
So how would i get the data to appear on the template I made?
the template looks like this
I also connected my form template to the cms but when i checked my entry it wasn't on the comments app.
Do you see your data if you use
<perch:showall />
?I don't know what that means.
Hi Drew, Finally got this to work. The only problem left is that there is an upload image field on the form and It doesn't seem to show on the page.
this is my code on the comments_form.html
on my job-list html (which is the template I use to display comments) here is my code
How do I also show these custom fields on the CMS? and how can I set the status default to pending?
Thanks!
There's nothing in the Comments app to handle an image upload.
Yikes! That's too bad.. hmmm is there a way to work around this?
And also the fields? how can i display the custom fields i made on the cms of the comments app as well as setting the default status to pedning?
Thanks Drew!
The default status is pending. The exception is if you post while logged in.
Custom fields should be there - check your
<perch:showall />
output.Oh, okay. Got it Drew :) Thanks!
I will try that and see if the fields are shown on the admin.
Thanks ever so much Drew!
Hi Drew,
Good Morning!
I tried the <perch:showall /> tag and it did show the custom fields that I am working with but on the front-end. I wanna see these fields on the CMS and it should be editable by the administrator. Is that possible with the comments app?
Thank you!
Hi Drew,
Good Morning!
I tried the <perch:showall /> tag and it did show the custom fields that I am working with but on the front-end. I wanna see these fields on the CMS and it should be editable by the administrator. Is that possible with the comments app?
Thank you!
Yes, that should be possible. Just make sure they're added to the master template.
Hi Drew,
Okay. Which master template file should I place this tag? On the form template or the comment list template?
The master template for a comment is
comment.html
.Hi Drew,
It worked! thank you so much!