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

From Michael Dewsnip
DateThu, 27 Apr 2006 16:47:18 +1200
Subject Re: [greenstone-users] Press Enter to start the query with mgpp
In-Reply-To (44504823-8010004-dlconsulting-co-nz)
Hi Jonathan,

As Richard points out, the reason Enter doesn't work is that the "Begin
Search" button is of type "button" instead of "submit". Unfortunately,
you can't just change from one to the other -- you also need to change
the underlying Javascript to make everything work. I did this for the
Sudan Open Archive (http://www.sudanarchive.net) but can't remember the
exact details.

Try Richard's suggestion, and if you can't get that to work I'll try to
determine what you need to do to the Javascript for the "submit" change.
This is possibly something that should be done in Greenstone anyway.

All the best,

Michael

Richard Managh wrote:

> 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
>>
>>
>------------------------------------------------------------------------
>
>_______________________________________________
>greenstone-users mailing list
>greenstone-users@list.scms.waikato.ac.nz
>https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>
>