I am trying to use JQuery to create parent/child relationships and set a field in the child (lookup of parent) to that of the child. I am using Content Editors in the forms (these are just the main parts of the scripts, assume the getParameterByName function operates fine and all tags and ref's are correct):

Parent Form:

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

    var raidID = getParameterByName("ID");

    $("a[title='Add a new item to this list or library.']").each(function(index ) {
         onClick = $(this).attr('onclick');
         newOnClick = onClick.replace("?","?raidID=" + raidID + "&");
         $(this).attr('onClick', newOnClick);


Child Form:

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

    var raidID = getParameterByName("raidID");

    if(raidID != "") {


Now, this works for the Calendar form when I create a new child but with a custom list the child doesn't populate the ID field...

I traced this back to the fact that the Child Modal seems to null the "title" parameter of the select box and all you get is ID, ORIGINALID etc - so I tried referencing the select box by ID or ORIGINAL ID:




but this hasn't worked - is there another way to send a parent ID to a child modal dialog form or another way to reference a field that doesn't have a TITLE parameter set? Or am I missing something/doing something completely wrong?



  • It would appear, after further investigation that the <select> options are not populated until mouse-over... so, my belief is that jquery can't then select a .val() as there is nothing to select... Any pointers on how I can force mouse-over/population of the select field?
    – Alec
    Mar 29, 2015 at 21:06

1 Answer 1


For selecting id you should use

  • Thanks Amal, I will amend my code to use, but I've discovered another issued, stated as a comment to the original post. Thanks for the pointer though.
    – Alec
    Mar 30, 2015 at 7:45
  • I think you should set the val after the population of the select items. How are you populating the select items? Mar 30, 2015 at 12:06
  • I am not populating them, they are populated from the list field choice values. However, when inspecting the select field, it appears to have no options until you mouse-over it, at which point the field is populated. Are you suggesting that I should populated 1 value into the select field of the one I want to use? And then select it using .val? What is the best way of populating 1 value in to a select field?
    – Alec
    Mar 30, 2015 at 20:35

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.