Share via

SharePoint Online - Parent Child Lists JavaScript Not Working

Anonymous
2017-11-01T20:55:25+00:00

I am trying to make my child list take its lookup ID from the parameter in the URL and assign it to a dropdown.  The following code used to work but no longer does, any ideas as to why?

<script type="text/javascript" src="https://XXXTEAMSITEXXX/Scripts/jquery-1.11.1.min.js"></script>

<script type="text/javascript">

jQuery(document).ready(function($) {

    //get the ProjectName from they query string

    var batchID = getParameterByName("BatchID");

    //Set the corresponding Lookup field value to the Contact ID

    $("input[Title='BatchID']").val(batchID);    

    //use this line to disable the lookup field selection

    $("input[Title='BatchID']").attr('disabled','disabled')

    //use this line to hide the lookup field and label entirely

    //$("input[title='BatchID']").closest("tr").hide();

       $("select[title='Notes']").closest("tr").hide();   

       $('nobr:contains("Status of Transaction")').closest('tr').hide();

       $('nobr:contains("Sender Name")').closest('tr').hide(); 

       $('nobr:contains("Receiver Name")').closest('tr').hide(); 

});

function getParameterByName(name)

{

  name = name.replace(/[[]/, "\[").replace(/[]]/, "\]");

  var regexS = "[\?&]" + name + "=([^&#]*)";

  var regex = new RegExp(regexS);

  var results = regex.exec(window.location.href);

  if(results == null)

    return "";

  else

    return decodeURIComponent(results[1].replace(/+/g, " "));

}

</script>

Thanks for any assistance!

Ryan

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-11-02T00:59:15+00:00

Hi Ryan,

Based on your description, you have questions about Parent Child Lists JavaScript. I would suggest you go to our SharePoint MSDN forum. This is a dedicated support channel for SharePoint customization related issues.

Your understanding will be appreciated.

Yoga

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-11-01T21:08:47+00:00

    Are you getting any errors or is it just silently failing?  Use your browsers dev tools to see if any javascript errors occur when you load the page.

    Was this answer helpful?

    0 comments No comments