Re: [greenstone-users] Press Enter to start the query with mgpp

From Richard Managh
DateThu, 27 Apr 2006 16:27:15 +1200
Subject Re: [greenstone-users] Press Enter to start the query with mgpp
In-Reply-To (000001c6699b$5b512610$6401a8c0-WALLACE)
Hi Johnathan,

Probably the reason your searches arent initiating is that the mgpp search form "Begin Search" button, isnt a "submit" type form input control. Instead it uses an onclick property/event handler to call the javascript function beginSearch()  One "trick" you could use to start searches would be to capture when a user hits enter when the cursor is in any of the search input boxes.

add this javascript to the search page by modifying relevant macros:

function entsub(myform) {
  if (window.event && window.event.keyCode == 13){
  } else {
    return true;

add this code to the input type="text" tags of the search form by modifying relevant macros.

onkeypress="return entsub(this.form)"

I havent tested this method specifically, but used a variation on it a year or so ago for preventing the enter key submitting forms, so this or a slight variation on this should produce the desired effect.

My source for the idea is here:

hope this is helpful,

DL Consulting
Greenstone Digital Library and Digitisation Specialists

Jonathan Tremblay wrote:



In a collection built with mg, pressing Enter in a field of the search page starts the search. However, when using mgpp, it doesn’t work. I’ve looked at but did not understand the cause of this behavior.


What should I change to allow users to start queries with Enter?




Jonathan Tremblay

_______________________________________________ greenstone-users mailing list