<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">The generate_accession_identifiers plugin is an example of how to load javascript conditionally for a particular controller and action. For your case, you probably want to catch the top_containers controller for new and edit actions.</div><div class=""><br class=""></div><div class=""><a href="https://github.com/archivesspace/archivesspace/blob/master/plugins/generate_accession_identifiers/frontend/views/layout_head.html.erb" class="">https://github.com/archivesspace/archivesspace/blob/master/plugins/generate_accession_identifiers/frontend/views/layout_head.html.erb</a></div><div class=""><div class=""><br class=""></div></div><div class=""><table class="js-file-line-container highlight tab-size" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="L1" class="blob-num js-line-number" data-line-number="1" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC1" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><span class="pl-pse" style="box-sizing: border-box;"><%</span><span class="pl-sre" style="box-sizing: border-box;"> <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">if</span> controller.controller_name <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">==</span> <span class="pl-s" style="box-sizing: border-box; color: rgb(3, 47, 98);"><span class="pl-pds" style="box-sizing: border-box;">'</span>accessions<span class="pl-pds" style="box-sizing: border-box;">'</span></span> <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">&&</span> controller.action_name <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">==</span> <span class="pl-s" style="box-sizing: border-box; color: rgb(3, 47, 98);"><span class="pl-pds" style="box-sizing: border-box;">'</span>new<span class="pl-pds" style="box-sizing: border-box;">'</span></span> </span><span class="pl-pse" style="box-sizing: border-box;">%></span></td></tr><tr style="box-sizing: border-box;" class=""><td id="L2" class="blob-num js-line-number" data-line-number="2" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC2" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">  <span class="pl-pse" style="box-sizing: border-box;"><%=</span><span class="pl-sre" style="box-sizing: border-box;"> javascript_include_tag <span class="pl-s" style="box-sizing: border-box; color: rgb(3, 47, 98);"><span class="pl-pds" style="box-sizing: border-box;">"</span><span class="pl-pse" style="box-sizing: border-box;">#{</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(36, 41, 46);"><span class="pl-smi" style="box-sizing: border-box;">@base_url</span></span><span class="pl-pse" style="box-sizing: border-box;">}</span>/assets/generate_accession_identifiers.js<span class="pl-pds" style="box-sizing: border-box;">"</span></span> </span><span class="pl-pse" style="box-sizing: border-box;">%></span></td></tr><tr style="box-sizing: border-box;" class=""><td id="L3" class="blob-num js-line-number" data-line-number="3" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC3" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><span class="pl-pse" style="box-sizing: border-box;"><%</span><span class="pl-sre" style="box-sizing: border-box;"> <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">end</span> </span><span class="pl-pse" style="box-sizing: border-box;">%></span></td></tr></tbody></table><div class=""><br class=""></div></div><div class="">Inspecting the form html, the field you want to validate is: $( ‘input#top_container_barcode_’ ) </div><div class=""><br class=""></div><div class="">You can google many examples of how to validate forms using jquery.</div><div class="">Here’s one example:</div><div class=""><br class=""></div><div class=""><a href="https://formden.com/blog/validate-contact-form-jquery" class="">https://formden.com/blog/validate-contact-form-jquery</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">— Steve M. </div><div class=""><br class=""></div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Mar 16, 2018, at 11:31 AM, Rachel Aileen Searcy <<a href="mailto:rachel.searcy@nyu.edu" class="">rachel.searcy@nyu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div dir="ltr" class="">Hello everyone,<div class=""><br class=""></div><div class="">We're interested in configuring the barcode field of the top container record to enforce validation for the number of digits. It looks like this was included in the original development of the <a href="https://guides.library.yale.edu/archivesspace/ASpaceContainerManagement" class="">container management functionality</a>, but after poking around a bit in the system and available documentation I don't see any further information. If anyone has done this locally, could you be so kind as to tell me how you made this happen?</div><div class=""><br class=""></div><div class="">Thanks very much (and in the spirit of the season, go raibh maith agat 🍀),<br clear="all" class=""><div class=""><br class=""></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">Rachel Searcy<br class="">Accessioning Archivist, Archival Collections Management<br class=""><div class=""><span style="font-size:12.8000001907349px" class="">New York University Libraries</span><br class=""></div><div class=""><a value="+12129982631" class="">212.998.2539</a> | <a href="mailto:rachel.searcy@nyu.edu" target="_blank" class="">rachel.searcy@nyu.edu</a> <br class=""></div></div></div></div></div></div>
</div></div>
_______________________________________________<br class="">Archivesspace_Users_Group mailing list<br class=""><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" class="">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br class="">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<br class=""></div></blockquote></div><br class=""></body></html>