Idea for new field, wanting feedback

Idea for new field, wanting feedback, a forum discussion on Jojo CMS. Join us for more discussions on Idea for new field, wanting feedback on our Administration (backend and configuration) forum.

Back to Forum Index : Back to Administration (backend and configuration)   RSS
Rick Rick

12 Dec 2013
Posts: 336


To allow the easy adding of multiple (unlimited) rows within a field on an item in a one to many relationship but without moving away to another screen. (Similar to EE's Matrix field).

Useful for galleries, shipping calcs, document lists, product options etc.

Not currently intended for these items to have their own URLs (such as blog posts etc) but would be possible.

What fields must be compatible?

  • Checkboxes
  • File Upload
  • Lists (enum, db etc)
  • Radios
  • Text
  • Textarea
  • URL

Where to store the data?

Store rows in a new table?
id, tablename, columnname, order, field1, field2, field3
Or JSON encode the data?

Template for adding a new row

Store a new row (using each field's "new" system) as a jquery template or something.

Example field naming:

<input name="sort[1]" value="1" />
<input name="parentfield[1][fieldname]" value="one" />
<input name="parentfield[1][anotherfield]" value="valuehere" />

<input name="sort[2]" value="2" />
<input name="parentfield[2][fieldname]" value="two" />
<input name="parentfield[2][anotherfield]" value="valuehere" />

<input name="sort[3]" value="3" />
<input name="parentfield[3][fieldname]" value="three" />
<input name="parentfield[3][anotherfield]" value="valuehere" />

<input name="sort[new][]" value="4" />
<input name="parentfield[new][][fieldname]" value="empty1" />
<input name="parentfield[new][][anotherfield]" value="valuehere" />

<input name="sort[new][]" value="5" />
<input name="parentfield[new][][fieldname]" value="empty2" />
<input name="parentfield[new][][anotherfield]" value="valuehere" />

<input name="sort[4]" value="6" />
<input name="parentfield[4][fieldname]" value="empty3" />
<input name="parentfield[4][anotherfield]" value="valuehere" />

<input name="sort[new][]" value="7" />
<input name="parentfield[new][][fieldname]" value="empty4" />
<input name="parentfield[new][][anotherfield]" value="valuehere" />

New row template:

<input name="sort[new][]" value="" />
<input name="parentfield[new][][fieldname]" value="" />
<input name="parentfield[new][][anotherfield]" value="" />

  • JS can update the sort values when re-ordered
  • The "new" array won't collide with the existing entries
  • Supports multiple fields per row
  • All new entries start with the same values ("foo[new][]" etc)

Updating the DB

  • Existing entries are updated by their IDs
  • Deleted entries are removed
  • New entries are added
  • The sort values are updated from the POST sort values
  • Catch errors from fields and pass them back through to Jojo as if they were from this "field"

Displaying the field

  • An expanding box that lists current entries with a "New" button at the bottom.
  • Drag handles for re-ordering rows.
  • Should rows collapse to show only their title? Should this be optional?

Fetching from the DB

Manually queried for the time being.
I have another idea that will make this far better in the future.

I'm looking for feedback if anyone has any ideas on how to make this as universal as possible and if I've missed anything out.

I'm not sure when I'll get onto this, I have three other major ideas for Jojo updates as well but I'm about to have a whole lot more free time.

Edited to tidy a few things up.
Back to Forum Index : Back to Administration (backend and configuration)   RSS
You must be logged in to post a reply

You need to Register or Log In before posting on these forums.