Form Builder - checkboxes how-to?

80 views
Skip to first unread message

Brandon Weigel

unread,
May 3, 2017, 5:04:22 PM5/3/17
to islandora
I'd like to include a checkbox on my forms that, if checked, would add a snippet of XML below its parent name element (in addition to the role element that is already being applied): 

<role><roleTerm authority="marcrelator">creator</roleTerm></role>

The idea here is to allow the submitter to add a second "creator" role to a name, in addition to their more descriptive role (author, photographer, whatever), in order to indicate for DC transformation and third-party tools which person is primarily responsible. This has implications for assigning DOIs, etc.

A checkbox seems like it would be the easiest way to implement this without drastically altering my name fieldsets or allowing too much freetext entry. However, I can't seem to figure out how to do this within the Form Builder - or whether it is indeed even possible.

A "checkbox" element type does exist, as does a "checkboxes" element type -- but as far as I can tell, they don't actually do anything in terms of adding XML to your metadata. 

Is there a reasonable way to make this work? 

dp...@metro.org

unread,
May 4, 2017, 9:35:24 AM5/4/17
to islandora
Hi Brandon, checkbox(es) do not have crud actions since the logic to map a "checked = true = false" to "does that complex set of elements and values exist in your XML document?" is a bit more complicated and I think we have never attempt it in the past (we should!). But there are ways to accomplish that.
1. This is what I would do and I encourage you to do: program a new XML form element that actually does that. A good example is https://github.com/Islandora/islandora_xml_forms/blob/7.x/elements/includes/creative_commons.inc. So, in your case the checkbox logic would use the elements default value as comparison element (while doing  READ) to decide if checked is marked and then the XML value or element option, depending on how you want that, while doing a WRITE and UPDATE.Or in both cases the later?
And what about using tags and tag? not specially User friendly but with a bit of creative Texting/wording people could eventually do that.?

Just some ideas.

Diego Pino
Metro.org

dp...@metro.org

unread,
May 4, 2017, 10:04:10 AM5/4/17
to islandora
And now you got me thinking why we don't have this functionality... 
Let me do some tests and will come back to you on this...

Diego

Brandon Weigel

unread,
May 4, 2017, 4:40:05 PM5/4/17
to islandora
Sounds good, thanks! :)  I considered tags, but in my use case, I really do want particular roles to be assigned without user input, and just have the option whether or not to assign the "creator" role as well. Freetext tags would be more prone to user error. Checkbox feels like this would be the easiest way to do it (if such capability existed, of course).

Rosemary Le Faive

unread,
May 4, 2017, 5:06:35 PM5/4/17
to islandora
Relevant ticket from 2015 (feels like longer ago): https://jira.duraspace.org/browse/ISLANDORA-1369 

Tags/tag (or tabs/tab?) would be a way to get around it.

dp...@metro.org

unread,
May 5, 2017, 9:33:28 AM5/5/17
to islandora
Thanks Rosie! That ticket is a good flashback. I did some research last night (why do i keep working at nights??) and i didn´t saw any obvious reasons why a checkbox should not be able to read/create/remove XML snippets. I know it is not possible right now, but the "why" is what kept me up. So i will do some extra testing and a little bit of coding, maybe just overthinking this and will end agreeing with that ticket?. Checkboxes are kinda cool when dealing with user contributed metadata and the user doesn´t know much about metadada.

Cheers

Diego Pino
Metro.org

Brandon Weigel

unread,
May 5, 2017, 6:40:35 PM5/5/17
to islandora
This would make me very happy. Thanks, Diego!

dp...@metro.org

unread,
May 9, 2017, 9:29:46 AM5/9/17
to islandora
Folks, working on this. Seems like there will be a solution (code) that will enable this. Will see if I get it done before islandoraCon

Best

Diego Pino N
Metro.org

Brandon Weigel

unread,
Jun 1, 2017, 5:16:11 PM6/1/17
to islandora
Hi Diego! Just wondering if you'd had a chance to put any thought into this checkbox idea (though I'm certain the conference must have been a big distraction). Any good approaches come to mind?
Reply all
Reply to author
Forward
0 new messages