Advertisement
joelgoodman

Custom Field snippet

Feb 21st, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. ##Trick from HTML5 Boilerplate to only load jQuery if it hasn't already been loaded in this page (ie. by another custom field)
  2. ##Load the local version so as not to break HTTPS
  3. <script>window.jQuery || document.write('<script src="http://www.tiu.edu/resources/js/jquery-1.6.1.min.js">\x3C/script>')</script>
  4. <script type="text/javascript">
  5.  
  6. ${esc.d}.noConflict();
  7. jQuery(document).ready(function($) {
  8.  
  9. /* When page is loaded, copy the hidden field value to the dropdown */
  10. var initialValue = $("#showDepartment").val();
  11. $("#showDepartment_field select").val(initialValue);
  12.  
  13. /* When new option is selected, copy dropdown value to the hidden field */
  14. $("#showDepartment_field select").change(function(){
  15. $("#showDepartment").val($(this).val());
  16. });
  17. });
  18.  
  19. </script>
  20. <select>
  21. <option value=" ">--</option>
  22. #foreach($dept in $dotcontent.pull("+structureName:DepartmentOffice",0,"DepartmentOffice.deptName"))
  23. <option value="$dept.identifier">$dept.deptName</option>
  24. #end
  25. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement