This topic is locked

Minimum Search Character on List Page

10/20/2008 4:41:58 AM
ASPRunnerPro General questions
P
paulyap2k author

Hi There,
Have tried playing around with this from a previous post. http://www.asprunner.com/forums/index.php?...l=search++limit
but it does not seems to work. Assistance from anyone would be appreciated. I am a non programmer
Cheers

Paul

J
Jane 10/23/2008

Hi,
edit generated ..._list.asp file for this purpose.

Find this line:

xt.assign "searchbutton_attrs","onClick=""java script: RunSearch(" & id & ");"""



and replace it with this one:

xt.assign "searchbutton_attrs","onClick=""java script: if (document.forms.frmSearch" & id & ".SearchFor.value.length<4) alert('Enter four characters or more'); RunSearch(" & id & ");"""

P
paulyap2k author 10/23/2008

Hi Jane,
Thanks a million..
Any thought about starting fee based training session for knowledge like this. I believe many non programmer like myself would be willing pickup these knowledge that would save time.
Rgds

Paul

Hi,

edit generated ..._list.asp file for this purpose.

Find this line:
and replace it with this one:

P
paulyap2k author 10/24/2008

Hi Jane,
If 4 character or less is enter, it does pop up a message stating that 4 characters are required, but it continues to display the results even it character is less than 4.
Guess it does not work with the enter button as well. I have tried pasting this code as custom code insert in all the possible event on list and in search forms.
Would appreciate a pointer on this.
Cheers

Paul

Hi,

edit generated ..._list.asp file for this purpose.

Find this line:
and replace it with this one:

J
Jane 10/24/2008

Hi,
try to use this code instead:

xt.assign "searchbutton_attrs","onClick=""java script: if (document.forms.frmSearch" & id & ".SearchFor.value.length<4) { document.getElementById('ctlSearchFor').value=''; alert('Enter four characters or more'); } else RunSearch(" & id & "); """

P
paulyap2k author 10/24/2008

Hi Jane,
Thanks.....It works perfect this time..
However, by pressing enter, user would be able to skip this minimum character.
how would I enforce minimum 3 character search when users press enter.
I have tried placing the same code in various event and it does not seems to work with enter keys.
Thanks again..
Rgds

Paul

J
Jane 10/28/2008

Paul,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

P
paulyap2k author 10/29/2008

Hi Jane,
The database is on MySQL and am not sure how to have this uploaded to the demo account. But I would like to just state the assistance required to confirm that its not being understand wrongly.
The code you provided below works great when search button is click, but it does not work when user press the enter key. From the code, it seems to be a java onclick event instead of detecting an "enter" or character 13 event.
xt.assign "searchbutton_attrs","onClick=""java script: if (document.forms.frmSearch" & id & ".SearchFor.value.length<4) { document.getElementById('ctlSearchFor').value=''; alert('Enter four characters or more'); } else RunSearch(" & id & "); """
I am trying to figure if there is code to enforce minimum character for search if

  1. Enter button is press on the list page.
  2. Advance search page as it involves other fields ?
    Do let me know you would still required me to have this uploaded to the demo account for a solution, I will try to get some help from someone who's good at MySQL.
    Thanks again Jane.
    Regards,

    Paul Yap
    Paul,

    It's difficult to tell you what's happening without seeing actual files.
    Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

    I'll find what's wrong with your project inspecting it at Demo account site.