• Catchall

Speed up dev by not having to create a bunch of fields in the CP. Handy. The Catchall fieldtype is meant to be used with a SafeCracker Entry Form. It stores any form data you submit to it, flexibly adding fields on the fly. This is useful if you want to capture many fields of data without having to actually create all those custom fields. The Catchall fieldtype does not work without SafeCracker.


With the Catchall field, you determine which sub-fields it will contain by creating form inputs in your SafeCracker Entry form. It can store nested arrays of data, or a single row of data.

For instance, let’s say you wanted to capture some contact info with your entry form, in a Catchall field called customer_details:


{customer_details}
    {contact_info}<br />
        <label>Name</label>
        <input type="text" name="customer_details[contact_info][name]" value="{name}" /><br />
        <label>Address</label>
        <input type="text" name="customer_details[contact_info][address]" value="{address}" /><br />
        <label>City</label>
        <input type="text" name="customer_details[contact_info][city]" value="{city}" /><br />
        <label>State</label>
        <input type="text" name="customer_details[contact_info][state]" value="{state}" /><br />
        <label>Zip</label>
        <input type="text" name="customer_details[contact_info][zip]" value="{zip}" /><br />
    {/contact_info}
    {company_details}
        <label>Associates</label>
        <input type="text" name="customer_details[company_details][associates]" value="{associates}" /><br />
        <label>Printouts</label>
        <input type="text" name="customer_details[company_details][printouts]" value="{printouts}" /><br />
    {/company_details}
    <label>Company Name</label>
    <input type="text" name="customer_details[company_name]" value="{company_name}" /><br />
{/customer_details}

We have three rows of fields captured in our Catchall. The first row is a nested array of data, contact_info. The second is also a nested array, company_details. The last row is a single line of data, company_name.

To do the same thing within a SafeCracker {custom_fields} loop:


{if catchall}
    {contact_info}<br />
        <label>Name</label>
        <input type="text" name="customer_details[contact_info][name]" value="{name}" /><br />
        <label>Address</label>
        <input type="text" name="customer_details[contact_info][address]" value="{address}" /><br />
        <label>City</label>
        <input type="text" name="customer_details[contact_info][city]" value="{city}" /><br />
        <label>State</label>
        <input type="text" name="customer_details[contact_info][state]" value="{state}" /><br />
        <label>Zip</label>
        <input type="text" name="customer_details[contact_info][zip]" value="{zip}" /><br />
    {/contact_info}
    {company_details}
        <label>Associates</label>
        <input type="text" name="customer_details[company_details][associates]" value="{associates}" /><br />
        <label>Printouts</label>
        <input type="text" name="customer_details[company_details][printouts]" value="{printouts}" /><br />
    {/company_details}
    <label>Company Name</label>
    <input type="text" name="customer_details[company_name]" value="{company_name}" /><br />
{/if}

To display this data:


{exp:channel:entries channel="site"}
{customer_details}
    {contact_info}
    Name: {name}
Address: {address}
City: {city}
State: {state}
Zip: {zip}
{/contact_info} {company_details} Associates: {associates}
Printouts: {printouts}
{/company_details} Company Name: {company_name} {/customer_details} {/exp:channel:entries}

Converting from an existing SafeCracker Catchall fieldtype

If you previously owned and used the SafeCracker Catchall fieldtype, here are the instructions for converting your old safecracker_catchall fields to catchall fields. The functionality remains the same.

  • Upload the catchall/ folder to your third_party/ folder
  • Install the Catchall fieldtype (this installation will automatically convert your old safecracker_catchall fields to catchall fields)
  • In your templates, change all references to safecracker_catchall to simply catchall


Current Version

Add-on Supports: