문제

I just started using this tool, so I tested SetValue in order to familiarize myself with it. It seemed to only work whenever I hit the "Ok" button to the Content Editor web part of the new/edit form. Whenever I actually tried to create/edit a form, I was met with blank fields. Could someone let me know what I could be missing?

Here's my code:

<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="/MySite/SiteAssets/Code/SPUtility/sputility.min.js"></script>
<script>
    // wait for the window to load
    $(document).ready(function () {
       // EXAMPLE: Set the value of the Title field to Hello world!
       SPUtility.GetSPField('Title').SetValue('Hello world!');
       SPUtility.GetSPField('Occurrence No.').SetValue('25');
    });
</script>
도움이 되었습니까?

해결책

I once ran into a problem where my script was not executing because I forgot the "type" attribute in the script tag. Try changing your opening script tag to

<script type="text/javascript">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top