onSubmit

Hi

I have a bit of java called search which runs when a user enters a value in a field to search. If they press enter, they get form processed - which is no good. I can disable the enter key by putting return false in the onSubmit of the form but I want to run the search script when they press enter. Can anyone help

Thanks

Subject: onSubmit

What you can do is put the current document’s url in the $$Return field…then upon submit, you’re still there. If you have no need for the docs, keep them in a hidden view and delete them with nightly agent.

Create a ComputedForDisplay field that contains:

“[” + HTTP_REFERER + “]”

Subject: RE: onSubmit

Hi thats great but I would like to run the search script when the user presses either or presses the search button

Thanks in advance

Mark

Subject: RE: onSubmit

Hello,

You can use a hidden button(copy of submit button with different name and value) on the form and use following code if user presses enter(return) key:

document.forms[0].hiddenbutton.click() just like you plan to use return false.

Hidden button will work just like submit button.

Regards,

Munish Kaushik

Subject: RE: onSubmit

Hi

I may be missing something here but i created a hidden button called submit and in there i entered the js code to run it called find Submit() - then in the onSubmit of the form, i entered document.forms[0].hiddenbutton.click() - i saved this and now get an error sating document.forms[0].Submit is null or not an object

Subject: onSubmit

Here are more ideas:

-or-

function checkEnter(event,searchterm) {

var code = 0

code = event.keyCode;

if (code==13) {

alert(“Please use the OK button to initiate a search.”);

document.forms[0].aTextField.focus();

return false;

}

}

Subject: RE: onSubmit

Where do I enter any of these scripts

The bottom one is preferable

Thanks

Subject: onSubmit - Fixed

Hi

I have managed to fix it

in the onSubmit I entered return findSubmit() , false

This lets the user enter a string in the field and when they press enter, it brings back the results