Solved

search not working when apostrophe is used

Posted on 2004-10-01
12
296 Views
Last Modified: 2013-12-18
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?SearchView&query=[LastName]="+query+"&SearchOrder=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-4712<td align="right">
<a href="/dynintranet/phonelist.nsf/Searchemployee/5D4E69C0237C6A0A86256DF200740D0D" class="results2">more...</a></td></tr></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

0
Comment
Question by:AboutLotus
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12200721
Include double qoutes around query

eg:

var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]=\""+query+"\"&SearchOrder=4";


~Hemanth
0
 

Author Comment

by:AboutLotus
ID: 12201345
Hey I tried that too but its not working.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12201452
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
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12201473
Ok , try %27 .

var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]=\"O%27Meara\"&SearchOrder=4";

cheers,

Tom
0
 

Author Comment

by:AboutLotus
ID: 12201513
I tried %27 and it is not working still.

Please help me with this.
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12201523
try this:

var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]="+unescape(query)+"&SearchOrder=4";

Partha
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:AboutLotus
ID: 12201593
This is also not working
0
 
LVL 24

Assisted Solution

by:HemanthaKumar
HemanthaKumar earned 20 total points
ID: 12202147
0
 
LVL 3

Expert Comment

by:Andrea Ercolino
ID: 12228515
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

0
 
LVL 31

Accepted Solution

by:
qwaletee earned 30 total points
ID: 12229385
Even in Notes you can't search on apostraphe.  There's really no workaround.  Oddly, you can't even search for, say O'Keefe, using "o*keefe" or "o keefe" -- it does not get treated as two words (space in middle) or one word (wild card in middle).  But the keefe part is in fact treated as a single word, so you could search for just keefe, or "[lastname=(o and keefe)"
0
 

Author Comment

by:AboutLotus
ID: 12235466
Hey guys thanks a lot for all who have taken pain in answering my ques.

Thanks
0
 
LVL 3

Expert Comment

by:Andrea Ercolino
ID: 12272530
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.
---

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now