Solved

search not working when apostrophe is used

Posted on 2004-10-01
12
300 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 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

11 Experts available now in Live!

Get 1:1 Help Now