I am trying to compare the value of a People Picker with the Created By on the EditForm. I wish to hide entire rows based on whether the Created By equals the People Picker value.

The kink I think, is that on our edit for there are 2 People Pickers, and both People Pickers will have different names in them (or should if the new form was filled out correctly).

My code is simply as follows:

<script type="text/javascript">

        var CreatedBy;
        var isMozilla = $.browser.mozilla;
        if (isMozilla) 
              CreatedBy = $("#onetidinfoblock1")[0].textContent.split('by')[1];
              CreatedBy = $("#onetidinfoblock1")[0].innerText.split('by')[1];

        var Approver = $().SPServices.SPFindPeoplePicker({
             peoplePickerDisplayName: "Approver",

        if (Approver == CreatedBy){
            $("select[title='Approval Status']").parent().parent().parent().hide();
            $("select[title='Decline Nomination: Choice Drop Down']").parent().parent().parent().parent().parent().parent().parent().hide();

NOTE: This is for SP2007. I do have other working jQuery, JS, and SPServices working on the same page.

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.