locked
Web Part On Click Event RRS feed

  • Question

  • Hello World! I am working on a Sharepoint Web Part that will allow users to search for people in Active Directory. Here is my code:

    <script type="text/javascript">
    function submitForm(containerElement) {

        var theForm = document.createElement("form");
      
            theForm.action = "http://portal.Hompage.com/Pages/EResults.aspx?SearchValue=" + document.getElementsByName('WPQ4SearchValue')[0].value;
            theForm.method = "GET";
            var e;
            e = document.createElement("input");
            e.setAttribute("type",document.getElementsByName('WPQ4SearchValue')[0].type);
            e.setAttribute("id",document.getElementsByName('WPQ4SearchValue')[0].id);
            e.setAttribute("name","SearchValue");
            e.setAttribute("value",document.getElementsByName('WPQ4SearchValue')[0].value);

            theForm.appendChild(e);
      
      var s;
      s = document.body.appendChild(theForm);
      s.submit();
    }
    </script>

     <div id="contactForm" align="center">
      <table>
     <tr><td rowspan="2"><img src="/PublishingImages/empty_profile2.jpg" alt="Employee Search Logo" /></td><td><input id="empSearchVal" name="SearchValue" type="text" onkeypress="if (event.keyCode == 13) document.getElementById('empsearch').click()" class="style1"/><input type="button" value="Go" onclick="submitForm(contactForm)" id="empsearch"/></td></tr>
     <tr><td><font style="font-size: xx-small">(Enter name, ext, dept, etc.)</font>
    </td></tr>
     </table>

     
     
     
     
     
       
      
     
     </div>

    Monday, August 19, 2013 11:50 AM