View Full Version : Problem With History() Function While Using Custom Scrollbar Script

01-16-2015, 11:22 AM
1) Script Title: Slick Custom Scrollbar script v1.1

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex11/scrollc.htm

3) Describe problem: I'm using your script with a radio button form on my website. The form is connected to a verification script that uses the "javascript:history.go(-1);" command to get back to the form with the user's input still intact. However, when this part of your script is added:

<script type='text/javascript'>

$( document ).ready( function() {
$( "div[rel='scrollcontent1']" ).customscroll( { direction: "vertical", bounce:0 } );


the user input is not returned to the form. This input is vital to the functioning of the website (the form is a bit long & I would rather not force the user to reinsert all of their information again due to script malfunctions). If there is any way to modify the script to fix this issue PLEASE let me know what needs to be done and how.

Thank you for your time in advance.

P.S. Test form is located:


* The verification program is invoked when AT LEAST one question is left unanswered before submission.

01-17-2015, 05:34 AM
Regardless of this script, javascript:history.go(-1); is an unreliable strategy for anything important because various browsers will react differently (if at all) when it's invoked. A better approach would be to set up your validation such that the browser never leaves the page that has the form on it until the form is considered valid. There are plenty of ways to do this. Google:

form validation

to find a selection of methods.

Ultimately though, if this is a serious form, it will be being processed on the server side. If that's the case, you will want fall back validation done after submission to catch anything javascript missed, or in cases where there is no javascript active on the client machine. If you set that up, you will want the server to reload the form page preserving the valid data. This can all be done using SESSION or other methods (in PHP) or similar in other server side languages.

Again, for anything important, one should never rely upon javascript:history.go(-1);

It's no more reliable nor consistent cross browser than is the browser's BACK button, which behaves differently in different browsers and is inconsistent at times even in the same browser.