I have developed a Employee Directory and got this javascript for criteria search. But I want to fetch all employees first and then apply criteria. How to set the value of "Fixed Query" of People Search Core Result webpart using javascript when I press the search button without giving any criteria.
<script language="javascript">
//function for enter on keyboard and apostrophes in search strings
function txtWildPeopleFinder_KeyDown(e)
{
if (e.keyCode == 13 || e.keyCode==10)
{
e.returnValue=false;
DoWildPeopleSearch();
return false;
}
else
return true;
}
function escapestr(str)
{
return str.replace("'","%22");
}
//staff search
function DoWildPeopleSearch()
{
var firstname = escapestr(document.all["firstname"].value);
var lastname = escapestr(document.all["lastname"].value);
var url;
//search on last name onnly (first name is empty)
if(firstname == "")
{
url = "BankDirectory.aspx?k=LastName%3A" + lastname;
window.location=url;
return;
}
//search on first name only (last name is empty)
if(lastname == "")
{
url = "BankDirectory.aspx?k=FirstName%3A" + firstname;
window.location=url;
return;
}
//search on first and last
url = "BankDirectory.aspx?k=lastname%3A" + lastname +
"%20FirstName%3A" + firstname;
window.location=url;
return;
}
</script><table width="100%" id="StaffSearchTable" border="0" cellspacing="0"
cellpadding="4"><tbody><tr><td width="80" nowrap="nowrap">First Name:</td>
<td width="100%"><input name="firstname" id="firstname"
onkeydown="txtWildPeopleFinder_KeyDown(event)" type="text" size="25" maxlength="55"/>
</td></tr>
<tr><td width="80" nowrap="nowrap">Last Name:</td>
<td><input name="lastname" id="lastname"
onkeydown="txtWildPeopleFinder_KeyDown(event)" type="text" size="25"
maxlength="55"/> </td></tr>
<tr><td></td>
<td><input onclick="DoWildPeopleSearch()" type="button" value="Search"/></td></tr></tbody></table>
<p>Enter all or part of a name<br/>e.g. A will find all names beginning with A</p>