Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The Joy of Subforms with Randy Carey


Published on

Presented at JoomlaDay Chicago 2019
Of all the features introduced throughout Joomla 3, subforms is the one I rely on most.  Subforms are a field type like text, dropdowns, and date pickers. Subforms solve important content issues and significantly improve usability in managing content and settings.

In this presentation I will provide an introduction to subforms, what they can do, and the flex points where we can customize them within our own projects and extensions.  Then I will demo and discuss the various ways I have deployed subforms across projects.  I’ve come across interesting client needs, and I will illustrate some creative solutions using subforms. 

For those of you who are a developer, I will show you how I incorporate subforms into my custom extensions.  If you are not a developer, you will be exposed to the potential of subforms and be able to contact me or another custom developer to solve that challenging content problem.

Published in: Software
  • Be the first to comment

  • Be the first to like this

The Joy of Subforms with Randy Carey

  1. 1. The Joy of Subforms! 
 • what they are • the problems they solve • how you can use them Randy Carey Careytech Studios, LLC
  2. 2. Remarkable Features in 3.x ● [3.0] Bootstrap ● [3.1] tags ● [3.2] content versioning ● [3.2] two factor authentication ● [3.3] microdata ● [3.4] frontend module editing ● [3.5] php 7 ● [3.6] subforms ● [3.7] custom fields ● [3.7] backend menu manager ● [3.8] new routing system ● [3.9] privacy system ● [3.9] action logging Of all the major features of 3.x, the one that I use the most is subforms. I build a lot of custom extensions for clients, and subforms solves a lot of challenges.
  3. 3. Agenda • what ARE subforms • problems solved with subforms • acknowledging the few challenges • where/how you can use them • examples of problems I’ve solved with subforms • demo: working with subforms
  4. 4. What ARE subforms • A field type (like text, dropdown, date picker, media, etc.) • A collection of 0-to-multiple records • the record is a collection of fields of varying types • almost 100% customizable
  5. 5. Joomla field types: An example of the editable portion of a subform.
  6. 6. Customizable set of fields Examples of how each subform can have its own fieldset.
  7. 7. Multiple records A subform can be one record, or it can hold as many as the user wants to create.
  8. 8. Drag-and-Drop Ordering
  9. 9. Interchangable Form Layouts Here are examples of the three layouts Joomla provides. But we can design our own – which is very helpful for custom data needs
  10. 10. problems solved with subforms Clients often have challenging needs. Often, subforms play an important part of the solution.
  11. 11. Problems solved: no limit on items 1 2 3 The Articles form has a fixed number of fields for links. That was before we had subforms. With Subforms, we could let users create as many links as they’d like.
  12. 12. Problems solved: easy re-ordering Also, the user would be able to drag-and-drop re-order their links. Reordering the old way required a lot more work.
  13. 13. Problems solved: different orderings In this scenario, the order of these managers vary upon each product page. - With the component’s order field, we can not satisfy this requirement. - With subforms, we can order each without relying on the component’s order.
  14. 14. Problems solved: many-to-many Article Article Article Article article author 1 22 1 36 2 17 2 22 3 36 4 17 4 36 In the old way, we would create a separate table just to manage many-to- many associations. Example: 
  15. 15. Problems solved: many-to-many Article Article Article Article With subforms… many-to-many does not require an extra db table, and managing these association is easy for users.
  16. 16. Problems solved: reusable fieldsets If a set of fields are commonly used together, we can quickly reuse that set of fields by referencing the same XML file. In this example, the fieldset is for a background image with text.
  17. 17. Problems solved: extensible 
 – embracing change!
 – custom fields We must “embrace change” – because new requirements often emerge. Adding a field is as simple as adding a field declaration to the XML file. In contrast, adding a new field to a component requires changes to the db and multiple parts of the MVC. Here is a suggestion: If a third-party component provides an empty subform field, any user can safely add extra fields to that component by adding them to the subform’s XML file.
  18. 18. Problems solved: custom form Here is an example in which I built the edit form for a client who has special pricing charts. This custom layout logically mimics the client’s mental model of his data.
  19. 19. Values of subforms • custom set of fields • multiple records • sortable records • variable # of records • multiple orderings • many-to-many • extensible – custom fields • tailored/custom forms
  20. 20. challenges • Some light coding required • Edit the XML file to declare the fieldset. • Edit the layout file for displaying this data – the same skill used in layout overrides
  21. 21. challenges • Some light coding required • not easy to add to a third-party extension There are a few tricks. • The extension may allow you to add an extra field, and if so, add a subform. • Create a new menu item type off the component’s view. Add a subform as a parameter to that menu item.
  22. 22. challenges • Some light coding required • not always easy to add to a third-party extension • Searching on values • Entire subform is stored as a single JSON string, so an SQL query must use %LIKE% and be thought through carefully.
  23. 23. Where / How you can use them
  24. 24. Where / How you can use them Component • As a custom field with a plugin for subforms • • eShop : as an extra field (other extensions may offer this) • Create a new menu item type for component, add a subform as a parameter. • Component-Creator: create your own component that you can edit • Outsource – find a skilled Joomla developer
  25. 25. Where / How you can use them Modules & Plugins • Create your own • Clone an existing one, modify the XML file (to include a subform) • Outsource
  26. 26. Examples: problems solved with subforms In this part of the presentation I demoed some examples from real projects .
  27. 27. Examples: 
 problems solved with subforms Each alternating block is a record within the subform. • Each block has its own settings using a common fieldset (image, background color, text, etc.) • User can create as many as he/she likes. • User can drag-n-drop order blocks.
  28. 28. Examples: 
 problems solved with subforms A vendor of biological supplies wanted an online catalog with the ability to customize a grid of prices (per piece, per class size, per volume, whatever based upon the item). The grid needs to accommodate a variable number of rows and columns.
 Each pricing grid on an item is a subform.
  29. 29. Examples: 
 problems solved with subforms Many diverse examples could be shown – both, as to how they help a user manage content, and as to how they are displayed on the frontend.
  30. 30. The Joy of Subforms! 
 • what they are • the problems they solve • how you can use them Randy Carey Careytech Studios, LLC