0

I'm modifying a custom new/edit form, and need to hide a column based on a selection from a multiple lookup column (using resources lookup form group calendar). I've used the following code below which works fine for a single lookup, but not for a multiple.

Rook = multiple lookup column Title = field trying to hide

<script type="text/javascript" src="...../jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    // add change handler
    $("select[title='Rook']").change(function() {
        MasterSelectChange();
    });
    // call the change function to set up form for first display:
    MasterSelectChange();
});

function MasterSelectChange()
{
 var mySelectValue = $("select[title='Rook']").val(); 
 if (mySelectValue == "2")
    {
     $("input[title='Title']").closest("tr").hide();

      }
    else
    {
      $("input[title='Title']").closest("tr").show();

    }
}
</script>

I'm also wondering, if it might be easier to have the lookup values filtered based on the dropdown value?

  • Try using something like SPServices i think it has functions like SPCascadedropdown or you can use something like <a href="alstechtips.blogspot.in/2013/08/…> – luckydeveloper Apr 17 '14 at 5:22
  • I used to use JS on entry forms, but now I find InfoPath much more effective for making these types of customizations - might be worth checking into if you haven't before. – Hutch Apr 23 '14 at 20:27
  • I wish I could use InfoPath but the place I work at does not have InfoPath 2010..we're still on Office 2007. – David Apr 24 '14 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.