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

From Jonathan Tremblay
DateFri, 28 Apr 2006 17:05:35 -0400
Subject RE: [greenstone-users] Press Enter to start the query with mgpp
In-Reply-To (043E0C44967387478662B95CDAEBC0A72A9704CB-quebec-praxnet-local)

Hi Richard,

 

The script that you suggested worked with Internet Explorer, but not with FireFox… So I combined it with a script found on the web site you referred. Now it works with both navigators (but not with Netscape 4…). Here’s the recipe…

 

Add this to the _formpagescriptextra_ macro:

function entsub(event,ourform) {

  if (window.event && window.event.keyCode == 13)

    beginSearch();

  else

    if (event && event.which == 13)

      beginSearch();

    else

      return true;}

 

Add this to each input=”text” tag:

onkeypress="return entsub(event,this.form)"

 

Thanks,

 

Jonathan Tremblay


De : Richard Managh [mailto:richard@dlconsulting.co.nz]
Envoyé : 27 avril 2006 00:27
À : Jonathan Tremblay
Cc : Greenstone
Objet : Re: [greenstone-users] Press Enter to start the query with mgpp

 

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