Fieldset Objects Add Unlimited Development Flexibility

Table of Contents

    Subscribe for Email Updates
    fieldset-post-img

    Building a website requires planning and serious attention to detail. Every element on every page needs consideration for how editors will add or update its content. For most content, developers can easily create a list of editable regions and then display them on a page. But what about a repeating list of custom data, like a person’s certifications or degrees? Or a product technical specifications that varies from one product to the next?

    Prior to Marketpath’s latest release, Operation Discollama (aka Release 1.3.1), developers could use a datastore to create objects with custom fields. Datastores are very powerful containers and the items within them can have their own pages and templates, can be linked to other datastores, and be queried throughout the entire site (fig. 1).

    datastore-item-page
    Figure 1 - Datastore Item page

    This works well if data needs to be normalized and reusable in other areas of the site. But if the data only applies within the context of a single page, a Datastore is overkill. It also adds extra work and potential confusion for editors.

    Fieldsets

    fieldset-multipleThe Marketpath CMS Fieldset object provides the capability to create repeatable lists of custom and complex content types without the extra overhead of a datastore.

    A Fieldset object contains a set of fields such as text, html (WYSIWYG), checkbox, radio, link, image, document, etc. It can even add other fieldsets for repeatable lists inside repeatable lists!

    Creating a Fieldset

    A Fieldset can be added to templates, datastores, custom profile settings, and custom site settings. The Fieldset object type appears all the way at the bottom of the New Field dialog. Once selected you can begin to add fields to it (fig 2).

    fieldset-template-create
    Figure 2 - Adding a new Fieldset object and its fields

    Fields inside a fieldset can also be conditional on other fields inside that fieldset and enforce validation of the content.

    Editing a Fieldset

    One major benefit of using a Fieldset is that the editing takes place inline with all the other editable fields (fig. 3). You never leave the context of the page or entity you’re editing, unless the Fieldset field requires a selection of some sort. Those lists are also sortable - making it easy to reorder content with a simple drag-and-drop interface.

    fieldset-editor
    Figure 3 - Editing a fieldset, adding degrees

    Displaying Fieldset Data

    Displaying the fieldset data is incredibly easy to do in Marketpath CMS templates. In the example below, the Fieldset id is degrees_certifications. We simply iterate through its items and reference the individual fields, such as degrees_certifications.institution.

    {% for degrees in entity.degrees_certifications %}
      <h5>{{ degrees.name }}</h5>
      <div>{{ degrees.institution }}</div>
      <div>{{ degrees.year }}</div>
    {% endfor %}

    The sample page will render out like figure 4. Of course, we’ve stripped some wrapper tags and classes to simplify the example.

    fieldset-rendered-example
    Figure 4 - Example of a rendered Fieldset list of custom objects

    Unlimited Flexibility

    Marketpath CMS was already quite powerful and flexible before Fieldsets but now there are unlimited ways to build and make content editing easier than ever. Save editors time and confusion by incorporating Fieldsets into your site today.

     

    Related Tags:

    About the Author

    Matt Zentz

    Matt Zentz launched Marketpath from a small Broad Ripple bungalow in February 2001 with a focus on custom web application development. He built the first, basic version of a hosted CMS called Webtools and shortly afterward expanded his team and created the first version of Marketpath CMS.

    Matt has worked for a national consulting firm, taught computer programming to high school juniors and seniors , and led the information technology arm of the auxiliary business units at Indiana University.

    Matt graduated from Indiana University in 1999 with a B.S. in Computer Science and has built custom web applications since 1995. Matt is husband to an amazing & supportive wife, has three beautiful children, supreme master to Archimedes (Archie) the dog, and mostly tolerant victim of 2 flying rats (cockateils).

    He coaches various kid sports, enjoys furniture and home renovation projects, and plays guitar and piano. Matt is also active with his church as a parishioner, technical advisor and board member on the festival committee.

    Subscribe for Email Updates