AboutLotus
asked on
search not working when apostrophe is used
I search the info based on name. I get the name from the user thru a form which has the following code
I have a field "emp_search" to get the value.
<script language="JavaScript">
function empsearch(form){
var query = form.emp_search.value+"*";
var href = form.dbpath.value + "/Searchemployee?SearchVie w&query=[L astName]=" +query+"&S earchOrder =4";
location.href=(href);
}
</script>
and the Searchemployee view is like this
lastname value
abella <script> var color=((2%2)==1)? 'eeeeee':"#ffffff"; document.write ('<table width=100% border=0 cellpadding=2 cellspacing=0 bordercolor=dddddd align=center><tr bgcolor='+color+'><td class="results" width=40%>Abella, Gabriel</td><td class="results">713-767-47 12<td align="right">
<a href="/dynintranet/phoneli st.nsf/Sea rchemploye e/5D4E69C0 237C6A0A86 256DF20074 0D0D" class="results2">more...</ a></td></t r></table> '); </script></td></tr></table ></TD></TR >
this view has details for all the last name.
The problem is when I give the last name with apostrophe it is not searching. eg if I give O'Meara it is not searching.
How can I avoid this?
Please help me.
Thanks in advance
I have a field "emp_search" to get the value.
<script language="JavaScript">
function empsearch(form){
var query = form.emp_search.value+"*";
var href = form.dbpath.value + "/Searchemployee?SearchVie
location.href=(href);
}
</script>
and the Searchemployee view is like this
lastname value
abella <script> var color=((2%2)==1)? 'eeeeee':"#ffffff"; document.write ('<table width=100% border=0 cellpadding=2 cellspacing=0 bordercolor=dddddd align=center><tr bgcolor='+color+'><td class="results" width=40%>Abella, Gabriel</td><td class="results">713-767-47
<a href="/dynintranet/phoneli
this view has details for all the last name.
The problem is when I give the last name with apostrophe it is not searching. eg if I give O'Meara it is not searching.
How can I avoid this?
Please help me.
Thanks in advance
ASKER
Hey I tried that too but its not working.
You must use the translated codes in your script, eg. %20 for space.
I can't tell you what ' is from the top of my head, but I'm sure you'll be able to find it somewhere....
cheers,
Tom
I can't tell you what ' is from the top of my head, but I'm sure you'll be able to find it somewhere....
cheers,
Tom
Ok , try %27 .
var href = form.dbpath.value + "/Searchemployee?SearchVie w&query=[L astName]=\ "O%27Meara \"&SearchO rder=4";
cheers,
Tom
var href = form.dbpath.value + "/Searchemployee?SearchVie
cheers,
Tom
ASKER
I tried %27 and it is not working still.
Please help me with this.
Please help me with this.
try this:
var href = form.dbpath.value + "/Searchemployee?SearchVie w&query=[L astName]=" +unescape( query)+"&S earchOrder =4";
Partha
var href = form.dbpath.value + "/Searchemployee?SearchVie
Partha
ASKER
This is also not working
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A workaround: change all of your docs so that a new field for searching is added
FIELD LastNameEncoded := @URLEncode( "Domino"; LastName );
Then change the query so that it looks inside LastNameEncoded
FIELD LastNameEncoded := @URLEncode( "Domino"; LastName );
Then change the query so that it looks inside LastNameEncoded
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey guys thanks a lot for all who have taken pain in answering my ques.
Thanks
Thanks
NOTE
the problem described in this question is NOT an issue for my notes system (using Notes 6.5.1)... ie I can search for an apos with total control without any problem, and I tested it both remotely through the web browser and locally in the notes client!!
For example,
the document with title like is found when searching hits
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -
11'09''01 - September 11 (2002) [title]='' 1
Rosemary's Baby (1968) [title]=' 60
Buffalo '66 (1998) [title]='66 2
Matrimonio all'italiana (1964) [title]=all'italiana 1
---
Just for posterity,
my formula in comment #12228515 is wrong. This one works instead:
FIELD LastNameEncoded := @ReplaceSubstring( LastName; {'}; "_" );
and when searching for something with an apos, do the same substitution and look inside the LastNameEncoded field.
---
the problem described in this question is NOT an issue for my notes system (using Notes 6.5.1)... ie I can search for an apos with total control without any problem, and I tested it both remotely through the web browser and locally in the notes client!!
For example,
the document with title like is found when searching hits
--------------------------
11'09''01 - September 11 (2002) [title]='' 1
Rosemary's Baby (1968) [title]=' 60
Buffalo '66 (1998) [title]='66 2
Matrimonio all'italiana (1964) [title]=all'italiana 1
---
Just for posterity,
my formula in comment #12228515 is wrong. This one works instead:
FIELD LastNameEncoded := @ReplaceSubstring( LastName; {'}; "_" );
and when searching for something with an apos, do the same substitution and look inside the LastNameEncoded field.
---
eg:
var href = form.dbpath.value + "/Searchemployee?SearchVie
~Hemanth