Hi,
I am using a form content web part for search in sharepint server 2007.
This is the javascript code i am using.Which will give 2 dropdown boxes to filter the search.
Now my requirement is,Based on the permission level i want to show lenders to users.
Suppose,if lender1 doens't have prmisson for lender2,i want dropdown should hide the option of lender2 in Lender dropdown
Code goes like this.
<div onkeydown="javascript:if (event.keyCode == 13)
location.href=SearchStaff(
)">
<div>
<input type=text id="keywords" name="keywords" length="25"/>
<a href="#">
<img src="/_layouts/images/SPSS
earch2.gif
"
onclick="javascript:locati
on.href=Se
archStaff(
)"
border="0">
</a>
</div>
<select id="lenders" name="lenders">
<option value="">By Lender</option>
<option value="Lender1">Lender1</o
ption>
<option value="Lender2">Lender2</o
ption>
<option value="Lender3">Lender3</o
ption>
<option value="Lender4">Lender4</o
ption>
<option value="Lender5">Lender5</o
ption>
</select>
<select id="documentCategories" name="documentCategories">
<option value="">By Document Type</option>
<option value="Application Forms">Application Forms</option>
<option value="Policy">Policy</opt
ion>
<option value="Products">Products<
/option>
<option value="Special Offer">Special Offer</option>
<option value="Tools Calculators and Contacts">Tools, Calculators & Contacts</option>
<option value="Newsletters">Newsle
tters</opt
ion>
</select>
</div>
<script language="javascript">
function SearchStaff()
{
//Calculate the Search URL to return
//NOTE: The "forms[0]" reference is something that may
// not be very stable. If additional forms are added
// to the page, this reference may break.
var Keyword = document.forms[0].keywords
.value;
var Lender = document.forms[0].lenders.
options[do
cument.for
ms[0].lend
ers.select
edIndex].v
alue;
var DocumentCategory = document.forms[0].document
Categories
.options[d
ocument.fo
rms[0].doc
umentCateg
ories.sele
ctedIndex]
.value;
return "/searchcenter/Pages/resul
ts.aspx?k=
lender%3A'
" + Lender + "'%20DocumentCategory%3A'"
+ DocumentCategory + "'%20" + Keyword;
}
</script>.
Start Free Trial