This topic is locked
[SOLVED]

 Stopping a search form from displaying all records

2/9/2010 1:57:07 PM
ASPRunnerPro General questions
R
ricor author

My project is worthless if visitors can display all records by hitting search with noting in the search field.
I have successfully removed the search options, but the empty search still returns all records.
The only thing I can think to do at this point is restrict the table1_list.asp page from viewing all records.
So the question is, does anyone know how to reduce the height of the display of records on the table1_list.asp page? I assume you change it on templates/Table1_list.htm but can not find the code.
THANKS!
Page in question is www.americanpetassociation.org/approval

Sergey Kornilov admin 2/9/2010
R
ricor author 2/15/2010

That article is for a simple search when the program only offers to make an advanced search.
Is there any way to do the same with the advanced search?

J
Jane 2/16/2010

Hi,
here is a sample for advanced search:

if request("a")="adbsearch" and request("value_FieldName1")="" and request("value_FieldName2")="" then
strWhereClause = " 1=0"
end if
R
ricor author 2/16/2010



Hi,
here is a sample for advanced search:

if request("a")="adbsearch" and request("value_FieldName1")="" and request("value_FieldName2")="" then
strWhereClause = " 1=0"
end if



Thanks for the code! What file does this get applied to? I have looked in Table1_search.asp and templates/table1_search.htm for simular code to replace with this but no luck.
Thanks.

R
ricor author 2/16/2010



See instructions at http://xlinesoft.com/asprunnerpro/docs/make_search_button_return_data_only_when_search_value_was_entered.htm


Unfortunately that "help" file does not explain what to do. Do I place the code on line 1? All on one line or on three lines? Delete the green text? How do I save it? Do I click "add action" or just build after the code is placed there?
A help file will usually explain every step and not leave the user to guess what to do.
I have done this before, guessing to add it to the first three lines, delete the green text, then just build the project but it did not change anything.
Thank you

Sergey Kornilov admin 2/17/2010

Green text is comments. Comments don't need to be deleted. You can leave them or delete them.
All you need to do is to paste code from this forum post to event code. Doesn't matter what line you pasting it to.
If you done that and it didn't work that means one of the following:

  • you did something wrong i.e. didn't replace 'FieldName' with the actual field name
  • your situation is different from what you describe and this code won't work
    Impossible to tell what might be wrong without seeing your application. If you need help with this post it to demo account and contact support team directly.

J
jmclain 2/17/2010

The following works for me when I want to require a field in Advanced Search. . . use List Page Before SQL Query Event



if request("a")="advsearch" and request("value_FieldName")="" then

strWhereClause = " 1=0"

response.write "<script>alert('!!! Please provide required search parameters !!!')</script>"

end if


Replace FieldName with one of your actual field names in your Advanced Search form.

Hope this helps!

R
ricor author 2/17/2010

Die Hard, that worked! Finally, thanks!!!
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=47868&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />