statamic / workshop

Create and edit entries, pages, and globals on the front-end of your site without the control panel.
https://statamic.com/marketplace/addons/workshop
3 stars 2 forks source link

Whitelist fields, toggled on, block the title from being saved #8

Closed danielfowler closed 8 years ago

danielfowler commented 8 years ago

In the settings CP:

Whitelist fields in fieldset
Allow only the fields explicitly set in the fieldset to be saved. Everything else will be ignored.

While this is toggled on, Workshop:entry:create will not save the title (perhaps also the date, I didn't check a date-ordered entry) field, slugifying the next available field instead.

Here's my template code, where my generated files were named things like atlanta.md

{{ workshop:entry:create collection="studios" attr="id:create_studio" }}
  {{ if success }}
    <div class="green row window">
      <div><strong>Studio created</strong></div>
    </div>
  {{ /if }}
  <fieldset class="org_section">
    <legend>Studio Information</legend>
    <div>
      <label for="for_title">Studio Name</label>
      <input id="for_title" name="title" placeholder="studio name" type="text">
    </div>
    <div>
      <label for="for_city">City</label>
      <input id="for_city" name="city" placeholder="city" type="text">
    </div>
  </fieldset>
  <input type="hidden" name="owner" {{ user }}value="{{ id }}"{{ /user }}>
  <button class="large green btn">Submit</button>
{{ /workshop:entry:create }}

I did add title to my fieldset, but result didn't change.

danielfowler commented 8 years ago

I said I added title to my fieldset, but I just now added type: title to it, and it works now as expected.

The docs will need to include these details. Maybe y'all are already on it.

In summary, Workshop requires my fieldset to include:

fields:
  title:
    type: title
  other_field:
    type: text
  ...

when the whitelist setting is toggled on.