logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • owen
    • Posted on Thu 9 May 2002

    I tried capturing key presses and stuff but in the end the simplest solution (for me..) was to capture and redirect the submission process: this idea came from some other part of Jakes site.

    var query = document.forms[0].BodySearchString.value ; if (query == "enter search here" | query == "") { return false; } else { buildurl( query ); return false; }

    in the onSubmit event for the form and (simplified)

    function buildurl (query){

    if (query == "enter search here" | query == "") { alert( "please enter text to search"); return false; } else { //default alternative top.location.href ="./SearchFrameset?OpenForm&SearchString=" + query; //url opens new frameset with search string embedded in the search field in system navigator } }

    On the page/form there is a button

    <INPUT NAME=Search TYPE=button VALUE="Go" style="color='#000000';" onClick="buildurl(document.forms[0].BodySearchString.value);"/>

    Note the return false statements in the querybuilder function and onSubmit event - they are the equivalent of exit sub in script.

    feel free to contact me if you have any questions.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: