When uploading a document I have a choice field called "Document Type". The choice values are values such as PDF, Word, E-mail and such. When I upload a document with file extention .docx the Document Type is to choose the value "Word" automatically. I have got this working by using some jQuery I quickly put together like this:

if ($('.ms-fileField-fileExt').text().length > 0) {
  var $ext = $('.ms-fileField-fileExt').text()
  if ($ext.indexOf('doc') >= 0) { $('select[title="Dokument Type"] option[Value="Word"]').attr('selected', 'selected') }

and similar for other values.

I am creating sub-webs with document libraries based on a custom content type and I need to attach this script to the content type in some way. Adding the script through a CEWP by modifying the standard edit form works for the subweb I am on now, but it won't get applied the next time I make a subweb with document library (this happens automatically when I trigger a specific event). I was thinking that maybe Infopath might be able to do this, but I am unable to find out how.

Is there any way to attach a script to the DIP form in SharePoint 2013 for a custom content type?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.