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){
    beginSearch();
  } 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: http://www.cs.tut.fi/~jkorpela/forms/enter.html

hope this is helpful,

Richard
-
DL Consulting
Greenstone Digital Library and Digitisation Specialists
contact@dlconsulting.co.nz
www.dlconsulting.co.nz


Jonathan Tremblay wrote:

Hi,

 

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 query.dm but did not understand the cause of this behavior.

 

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

 

Thanks,

 

Jonathan Tremblay


_______________________________________________ greenstone-users mailing list greenstone-users@list.scms.waikato.ac.nz https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users