6

I was wondering if anyone who has experience using Sprout Forms might be able to steer me in the right direction on whether I'm better off using the Sprout Forms plugin or coding the forms traditionally. Here's a list of some of the main things in the forms.

  • 10 unique forms with about 30 fields each
  • One field will be Users Field Type (or another way to choose up to 3 users)
  • Front end forms will allow guests and logged in members to fill out
  • Back end admin will edit submitted entry form and fill out admin only fields which are hidden on front end
  • Ideally be able to conditionally display certain fields on the front end based on selections made by the person filling out the form (example: if person selected "Apple" choice in question 2, then show sub choices "gala", "Granny Smith". If person selected "banana" choice in question 2, then don't show any sub choices)
  • Form field content will need to be searchable so info can be displayed on front end template (show user how many forms he submitted, show field content based on date period)
  • Need to be able to create and display different reports on all 10 forms on a front end page (possibly export to csv too)

Thank you very much!

  • 1
    When you say 'code the forms traditionally' are you referring to using Custom HTML for Sprout Forms instead of the displayForm tag? – Ben Parizek Jun 24 '16 at 1:58
  • Sorry for the confusion, I meant not using Sprout Forms plugin at all and coding the forms directly in the template. I wasn't sure if Sprout Forms allowed me to treat the entries just like they were in a normal craft channel. I saw that entries are saved in the Sprout Forms plugin area in the Control Panel and wasn't sure if that meant they were separate in a data sense from the normal craft channels. – Lori Jun 24 '16 at 10:23
  • I saw that entries are saved in the Sprout Forms plugin area in the Control Panel and wasn't sure if that meant they were separate in a data sense from the normal craft channels. Also, if I have to use non standard form fields (like users field) then even if I could use Sprout Forms I'd need to use Custom HTML per Sprout docs rather than single line of code. – Lori Jun 24 '16 at 10:30
7

Sprout Forms offers you a lot of the same functionality as standard Craft Entries. Both Sprout Forms and Entries allow you to create front-end forms that allow users to submit data to the database. Here are a few thoughts on why you would choose one over the other to manage content that requires front-end forms. None of these reasons are absolute, so take them with a grain of salt for your own situation (and happy to modify this list if anybody has feedback in the comments):

Craft Entries

  • You want your submitted data to be managed alongside your other content on the Entries tab in the Craft Control Panel
  • Your submitted data has the concept of an "author" and can be related to a user in your database
  • Your submitted data has any other concepts that are specific to Entries, such as Post Date or Expiry Date
  • You want to manage the HTML for all of your forms and fields in your templates

Sprout Forms

  • You want to allow form submissions by anonymous users who are not logged into your website
  • You don't want all of your form data cluttering up the Entries area where you manage the primary content of your website
  • You want to create multiple, similar forms with variations on fields (such as creating a new form with slightly different fields to test a landing page)
  • You just want a backup of a submitted form in the database (the primary workflow will take place via a notification email that gets triggered when a form is submitted)
  • You want to be able to easily output your form in your templates dynamically (Sprout Forms handles all of the front-end code for you – including error states – with a single line of code). In addition, the base templates it uses to output the form can be customized using Template Overrides to meet your website design requirements.

Can Sprout Forms handle all of your requirements? Yes, however there are a few items worth mentioning as they may involve other Sprout plugins or custom development. I'll go into detail below.

  • 10 unique forms with about 30 fields each

Sprout Forms can handle as many fields as you need. And makes it easy to output them in your templates without having to create all the necessary HTML by hand using the displayForm, displayTab or displayField tags.

  • One field will be Users Field Type (or another way to choose up to 3 users)

Currently, we support three relations field (Entries, Categories, Tags). Adding support for the Users Relation field would be possible via a custom integration (mostly just copying one of those existing custom fields), or reach out and we may be able to add this to the core plugin. We held off on adding Users at this point as we wanted to get better feedback on how it would be used to know how to implement it best.

  • Front end forms will allow guests and logged in members to fill out

Any user can fill out a form. If you want to capture information about a logged in user, you can pass the information you want to track to a field in your form. Sprout Fields has two fields that are helpful for this, the Hidden Field and the Invisible Field.

  • Back end admin will edit submitted entry form and fill out admin only fields which are hidden on front end

Admins can edit the form via the Craft Control Panel. You can hide fields from displaying on the front-end in several ways. The Hidden or Invisible field give you some basic ways to do this, however are more for capturing values that are not visible to the user on the front-end.

Another way is to use Rendering Options which allow you to customize the id or class names of particular fields as they are dynamically output. You could, for example, add the class name of hidden to the fields you don't want displayed on the front-end and either supress their visibility or remove them from the page with javascript.

A final way would be to create a custom field that behaves exactly how you need it to.

  • Ideally be able to conditionally display certain fields on the front end based on selections made by the person filling out the form (example: if person selected "Apple" choice in question 2, then show sub choices "gala", "Granny Smith". If person selected "banana" choice in question 2, then don't show any sub choices)

This is going to be your most challenging item with both Craft Entries and Sprout Forms. You will likely have to write some custom javascript to get this behavior to work, and you'll have to keep this code in mind if you ever update your fields or naming conventions as the code on the page will probably only know what you tell it about how you have things setup in your database.

The easiest place to start here will be to see if you can target the default IDs output on your fields and add the behavior you need to them. If you need more customization of the class names for your code, Template Overrides and Rendering Options give you a lot of flexibility in how you structure your code for your needs.

There are probably several other approaches that can be taken here based on your specific use case so it would be best to talk this through with a developer who knows your project requirements well.

  • Form field content will need to be searchable so info can be displayed on front end template (show user how many forms he submitted, show field content based on date period)

Sprout Forms Form Elements and Sprout Forms Form Entry Elements (the user submissions in Sprout Forms) use Craft's Element Type API and are searchable in the same way that all Craft Elements are searchable.

You would need to be sure you are capturing the right user information in your form entries to perform the searches your require such as the userId. Sprout Forms captures date information about when a submission is created and modified.

  • Need to be able to create and display different reports on all 10 forms on a front end page (possibly export to csv too)

Sprout Reports is designed to work closely with Sprout Forms for your custom reporting needs. Out of the box, Sprout Forms has one report integration that lets you run a report on all of your submitted entry data. However, we purposefully de-coupled Sprout Forms and Sprout Reports to allow more customization for your reporting.

Sprout Reports enables you to create custom reports that provide different views into your Form data, add additional columns to your reports such as related user data, and customize what options an admin user has to select from when running a report.

Custom reports do require a developer to set them up, but they are very flexible and fairly easy to implement once you have clearly defined what you need. Please reach out to the Sprout Team if you have any questions on how these work or how to set them up.

All reports are exportable via CSV.

  • Wow Ben, thank you so very much for your detailed response! I now have a clearer understanding of the two options. Looks like for my purposes I could use either although I think Sprout Forms and Reports might make things a lot easier. I'll email the Sprout Team to discuss the Users Relation field integration into Sprout Forms plugin. Regarding the conditional fields, I found this tutorial discussing how to do it, formden.com/blog/conditional-form-field , as well as a form template pack on CodeCanyon, codecanyon.net/item/smart-forms , which includes the conditional feature. – Lori Jun 26 '16 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.