2

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>
3
  • 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"> Mar 3, 2016 at 18:19
  • @DylanCristy You are the man! That worked! Thanks! You should post that as an answer and I will mark it.
    – blutuu
    Mar 3, 2016 at 19:23
  • I will add it as a real answer then. Mar 3, 2016 at 19:24

1 Answer 1

4

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">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.