 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 24th, 2008, 07:31 AM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello, I have already tried again and it's work=)
Thanks
:)
|
|

June 25th, 2008, 05:04 AM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello,
I have a problem if I want to search "Regulation" in category "Memorandum" and in year "1984". I have 1 textfield and 2 dropdown menus. I confuse.
I tried this code but did not show the result.
<%
x = request.Form("search_category")
y = request.Form("search_year")
C_prefix = "contains("& x & ",'"
C_midfix = "') or contains("& x & ",'"
C_suffix = "')"
C_prefixs = "or contains("& y & ",'"
C_midfixs = "') or contains("& y & ",'"
C_suffixs = "')"
Function CreateContainsList( fromStr )
Dim temp, re
' the regexp ensures that multiple spaces become single spaces
Set re = New RegExp
re.Pattern = "\s+"
re.Global = True
' so get an array of words via split...
temp = Split( re.Replace( Trim(fromStr), " " ), " " )
' and make it into the contains list via join and helpers
CreateContainsList = C_prefix & Join( temp, C_midfix ) & C_suffix & C_prefixs & Join( temp, C_midfixs ) & C_suffixs
End Function
demo = request.Form("txtSearch")
'path = "form/document[" & CreateContainsList(demo) & " ]//*"
'Response.Write "<pre>" & demo & "" & path & "</pre>"
%>
|
|

June 25th, 2008, 01:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
So show the XPath that you think you should be using.
*NOT* the ASP code.
ONLY the XPath.
And WHY WHY WHY would you revert back to using a function that takes only one argument???? Seems to me you now need a function that takes *THREE* arguments.
|
|

June 26th, 2008, 12:05 PM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is the XPath:
path="form/document[<%= CreateContainsList(request.Form("txtSearch"))%>]//*";
|
|

June 26th, 2008, 01:28 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
No, we already know that code is wrong.
I need to see the XPATH that you *HAND CODE* that *DOES* work.
No ASP code in it at all. Just strings. Pure JS code.
|
|

June 28th, 2008, 05:06 AM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello, I have another problem. My thesis advisor ask me to make like this:
In my previous program, I make 1 drop down menu which consist of author, dates, category,etc.
If it looks like that, I just need 1 variable which is name of drop down menu.
Now, I was asked to make like this:
I have some check box which are: check box for author, check box for dates, check box for category, etc.
If I tick author, and type keyword "xyz" then the program only search for keyword "xyz" in scope author. The same condition if I want to tick author, category and title with keyword "xyz". Then, the program only search for keyword "xyz" in scope author, category and title.
Do you have any idea?
|
|

June 28th, 2008, 08:57 AM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I tried like this:
<%
a = Request.Form("desc_id")
b = Request.Form("title")
c = Request.Form("dates")
d = Request.Form("author")
e = Request.Form("file_name")
f = request.Form("type")
g = Request.Form("category")
h = Request.Form("status")
i = Request.Form("year")
C_prefix = "contains("& a & ",'"
C_midfix = "') or contains("& a &",'"
C_suffix = "')"
Function CreateContainsList( fromStr )
Dim temp, re
' the regexp ensures that multiple spaces become single spaces
Set re = New RegExp
re.Pattern = "\s+"
re.Global = True
' so get an array of words via split...
temp = Split( re.Replace( Trim(fromStr), " " ), " " )
' and make it into the contains list via join and helpers
CreateContainsList = C_prefix & Join( temp, C_midfix ) & C_suffix
End Function
demo = request.Form("txtSearch")
path = "form/document[" & CreateContainsList(demo) & " ]//*"
Response.Write "<pre>" & demo & "" & path & "</pre>"
%>
Now I don't want to use only variable "a" but also other variable inside C_prefix, midfix and suffix, depends on which option that user chose. And not only 1 option. User also can search the keyword with more than 1 option.
C_prefix = "contains("& a & ",'"
C_midfix = "') or contains("& a &",'"
C_suffix = "')"
|
|
 |