I’ve had good feedback from the client I implemented this for. It’s worth 
noting that it’s only going to work in newer browsers, and you’ll want to wrap 
it in another condition in your OpacUserJS.  

 

I like doing something like this:

 

var pathname = window.location.pathname;

if (pathname == '/cgi-bin/koha/opac-memberentry.pl'){

  $(window).bind("pageshow", function() {

    var form = $('#memberentry-form'); 

    form[0].reset();

  });

}

 

You could add some more checking around form as well. Probably using 
“form.length” since a selector that doesn’t match will usually still return an 
object I think. 

 

Maybe the pathname check is unnecessary, but I figure it saves the client 
browser from doing unnecessary work unless it’s on the correct page.

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Direct: 02 8005 0595

 

From: edward.m.veal [mailto:edward.m.v...@gmail.com] 
Sent: Tuesday, 17 April 2018 12:34 AM
To: Martha Fuerst <mfue...@hmcpl.org>; David Cook <dc...@prosentient.com.au>
Cc: koha-devel@lists.koha-community.org; Aaron Sakovich <asakov...@hmcpl.org>
Subject: Re: [Koha-devel] Clear OPAC self-registration form when back button 
pressed

 

Great find David, I think I will add it to our system.  

 

Ed

 

 

 

Sent via the Samsung Galaxy S7, an AT&T 4G LTE smartphone

 

-------- Original message --------

From: Martha Fuerst <mfue...@hmcpl.org <mailto:mfue...@hmcpl.org> > 

Date: 4/16/18 8:42 AM (GMT-06:00) 

To: David Cook <dc...@prosentient.com.au <mailto:dc...@prosentient.com.au> > 

Cc: koha-devel@lists.koha-community.org 
<mailto:koha-devel@lists.koha-community.org> , Aaron Sakovich 
<asakov...@hmcpl.org <mailto:asakov...@hmcpl.org> > 

Subject: Re: [Koha-devel] Clear OPAC self-registration form when back button 
pressed 

 

I’m for it! Thanks for this!

 

Marti Fuerst
Systems Librarian
Huntsville-Madison County Public Library
915 Monroe St, Huntsville, AL 35801
http://hmcpl.org/ — mfue...@hmcpl.org <mailto:mfue...@hmcpl.org>  





On Apr 12, 2018, at 8:55 PM, David Cook <dc...@prosentient.com.au 
<mailto:dc...@prosentient.com.au> > wrote:

 

What do people think about clearing the OPAC self-registration form when back 
button pressed? 

 

I used some code* from  
<https://stackoverflow.com/questions/8861181/clear-all-fields-in-a-form-upon-going-back-with-browser-back-button>
 
https://stackoverflow.com/questions/8861181/clear-all-fields-in-a-form-upon-going-back-with-browser-back-button
 to implement it and it worked pretty well on the latest Chrome on Windows 10.

 

That way you don’t have people finding personal information about other people 
just by pressing “Back” on a public computer. 

 

 

*

$(window).bind("pageshow", function() {

    var form = $('#memberentry-form'); 

    // let the browser natively reset defaults

    form[0].reset();

});

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Direct: 02 8005 0595

 

_______________________________________________
Koha-devel mailing list
 <mailto:Koha-devel@lists.koha-community.org> 
Koha-devel@lists.koha-community.org
 <http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> 
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website :  <http://www.koha-community.org/> http://www.koha-community.org/
git :  <http://git.koha-community.org/> http://git.koha-community.org/
bugs :  <http://bugs.koha-community.org/> http://bugs.koha-community.org/

 

_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to