1

Based on this question:

Calculating how long a user spend in New form and editform.aspx

I am having trouble adding the JSLink to the WebPart of the InfoPath Form. When I go to Edit WebPart, the field for JSLink is not available. I tried added the JS Link to "Script Editor", however, that does not work either. I am using SP Online with InfoPath Form.

Can someone please guide me how to add a JSLink to a InfoPath Form? I would greatly appreciate it.

Thank you, Jeff

2
  • Can you clarify some points please? Would it be easier to customize the form using Power Apps? Also, what if you just insert either a Content Editor Webpart or a Script Editor webpart to the form? Did you have any issues doing this? if so, what are the issues exactly? Mar 29, 2021 at 21:41
  • Hi @DenisMolodtsov, currently we are still using InfoPath Forms for a few more months. When I added the JS Link in either the Content Editor or Script Editor, it would so the URL/Link to the JS file. I am thinking I must need something before and after the JSLink Url?
    – JRossi
    Mar 29, 2021 at 21:57

1 Answer 1

1

I recommend using CEWP.

External file you reference by the CEWP must be an .HTML file. You can't reference .JS files. So, inside your external HTML file, add a <script>...</script> tag. Then, inside this script tag, add your JavaScript.

Example of the TimeTracker.html file

<script>
  alert('it works!') 
  // Add JavaScript that measures time
</script>

Your Answer

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

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