0

I want to update autopopulate sharepoint list new form when user open it. I am using below script and only "name" is working. Name is used in place of title field.

<script  type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link  type="text/css" rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/ui-lightness/jquery-ui.css" /> 
<script type="text/javascript" src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script> 
<script type="text/javascript">
$(document).ready(function() {
    alert('5');
    $("input[Title='Name']").val('GDPR readiness @ IT');
    alert('55');
    $("input[title='Owner']").val('user name');
    $("input[Title='Business owner']").val('fgfg');
    $("input[Title='Project owner']").val('gfgfggds');
    $("input[Title='Owner Organization']").val('Legal');
});
</script>

please let me know where I am doing wrong. Alert 55 is also not coming

4
  • I take it you want dynamic data so the regular default values wont be sufficient ? May 2, 2018 at 12:14
  • no these data would be static
    – Brishal
    May 2, 2018 at 12:45
  • If it is static I would just populate the default values in the fields of the list May 2, 2018 at 12:47
  • So the user that create this new item should not be able to change those fields afterwards? May 2, 2018 at 14:25

2 Answers 2

1

I had this issue , it was related to the title 'Name' and jquery but it was on chrome , the IE was working fine.

The Solution:

Rename the field title (for example Project Name)

Or (if the first solution is not possible)

Make this field as the last one you set in your script

$(document).ready(function() {
    $("input[title='Owner']").val('user name');
    $("input[Title='Business owner']").val('fgfg');
    $("input[Title='Project owner']").val('gfgfggds');
    $("input[Title='Owner Organization']").val('Legal');
    $("input[Title='Name']").val('GDPR readiness @ IT');
});
0

Take a closer look at the default values when you design the list.

Each field in the list can be assigned a default value which will be in the new item form if you fill it out.

Additionally you can also modify the visibility of the fields by toggling the "ShowIn..." fields between true and false. By filtering the field from the new form , you can enforce them basically.

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.