Bluto Posted December 5, 2014 Posted December 5, 2014 Using Pages I've been trying to create a form page. I figured I'd throw this on here and see if there was a better way to create a form using Pages. I feel forms are important to get valuable information from member of a community.Here's what I did:1. I created a database with a page without categories - called the page / database - Test Form.2. Created the fields I needed in the form.3. Created separate Display and Listing templates to be used with the form - called those Test Form Listing and Test Form Display - left the form template stock.4. Changed the settings in the Test Form database to use the custom templates in #3.At this point I played around with the permissions, trying to get member access to only the "add record" limiting a member ability to see the list of people who entered records / forms. I didn't have any success. Obviously, only the admin, mods, and the member who filled out the form should see what was entered into the form.Even if I had success modifying the permissions, I would still need a page for the member to go to after they submitted the form. Sending them to the Listing page without the permission to see that page... I wouldn't consider a successful form.Just a note: guests can't see the page or the link at all.So, I decided to copy the "add a record" link from the Test Form page I created and make it a menu item (or a link anywhere on the site if I chose) - so the member could click that and go right to the form avoiding the Listing page.5. Created menu item which when clicked goes directly to the "add a record" .Next I modified the Display and Listing templates I created in #3 with "if" statements. If an admin hit the Test Form page he would see a listing of the all members that filled out the form. If a member hit the page:A. If there were no records in the database for that member (never filled out the form) it would display a banner with a link to fill out the form.B. If there were records in the database for that member (filled out the form) it would display the records for only that member.In both cases A and B above I modified the categoryHeader template removing the "follow this content link" so that the member wouldn't click on it and get a notice every time someone filled out a form. I did this with a simple if statement allowing only admins and mods to see the categoryHeader information.I used another if statement to display only the specific members records. So if I made a comment on the record the member would be able to access it and reply. I did this by modifying the recordRow template:{{foreach $rows as $row}} {{if $row->member_id == \IPS\Member::loggedIn()->member_id}}I'm sure this could probably be done another way having a link in the menu go directly to the listing page and displaying the form if the member hadn't filled it out and the list if they had... haven't gotten that far yet.I was wondering if there was an easier way to do this? Maybe a page "form" which would make these steps a little easier? If something is already in existence, please let me know.
Vova Zk Posted June 27, 2017 Posted June 27, 2017 I came up with the same idea, @Bluto. I don’t need this amount of customization, but what I do need is get rid of the Title/Content fields, which seem to be mandatory. Did you find any way to get around that? Thanks in advance for your reply! P.S. Yep, do I understand this topic is 3 years old.
opentype Posted June 27, 2017 Posted June 27, 2017 You can make the content field non-required and set the field permissions so that the field doesn’t show up. The title field is always required, because frankly, you need something to identify the record, e.g. when browsing the records in the ACP or the listing view on the front end. But you can pick any field to be used as title field, so that shouldn’t be a problem.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.