naohirozrx / reallysimplehistory

Automatically exported from code.google.com/p/reallysimplehistory
Other
0 stars 0 forks source link

Problems with variable storageField in historyStorage #37

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Initially I was testing the example provided by O'Reilly Mail
(http://www.onjava.com/pub/a/onjava/2005/10/26/ajax-handling-bookmarks-and-back-
button.html?page=5)
and it's using the library dhtmlHistory.js which is the older version of
rsh.js. So, I decided to use to the newest version (RSH 0.6) with it. 

Unfortunately, it was prompting the following error: 
"'this.storageField' has no properties"

After using Firebug to see what was happening, I found out that the
variable 'storageField' does not have "value" property as it's stayed on lines:
#597 within "reset" method,
#643 within "loadHashTable" method,
#654 within "saveHashTable" method
of the released RSH 0.6.

The possible solution to this problem looks very straight forward: change 
"this.storageField.value" for "this.storageField" and actually it worked.
But I think there is a reason for placing a "value" property on it. 

Could someone please confirm this bug on the code?

Original issue reported on code.google.com by sergio.avalos on 6 Dec 2007 at 8:14

GoogleCodeExporter commented 8 years ago
historyStorage.storageField is a pointer to a DOM node for an HTML textarea. It
should always have a .value property. I will have to do some more investigation 
to
find out why these methods are getting called before the textarea has been
instantiated. Regardless, this should be as simple as checking to make sure that
.storageField is a valid DOM node before examining its value.

Original comment by bdpathfi...@gmail.com on 11 Dec 2007 at 6:01

GoogleCodeExporter commented 8 years ago
Sergio, can you clarify exactly what you are doing when you see this? Are you
attempting to plug RSH 0.6 directly into Brad's O'Reilly example application, 
or are
you experiencing this issue with the test page that ships with 0.6? The API for
adding RSH history points and storage hashes hasn't changed, but the 
initialization
methods have changed quite a bit since 0.6. If you are trying to use the newer
version of the library with this older application, you will definitely need to 
make
some changes. That said, I am still going to try to replicate this problem 
locally.

Original comment by bdpathfi...@gmail.com on 11 Dec 2007 at 11:53

GoogleCodeExporter commented 8 years ago
I'm encountering the same problem when I replaced the old version with the new, 
so
I've reverted to the older version for now. Sorry I couldn't provide more 
details -
if and when I get a spare moment, I'll look into this problem further to try to
pinpoint it's cause.

Great that you've taken over the project, Brian! Invaluable little script.

Original comment by ben.k...@gmail.com on 5 Jan 2008 at 8:30

GoogleCodeExporter commented 8 years ago
I has the same error on line:
      var serializedHashTable = this.storageField.value;

The problem was due to some code in my page doing a document.location change on 
some 
conditions.

The document.location change was done before calling 
window.dhtmlHistory.create(). 
There, during window.historyStorage setup, there is a 
document.write(textareaHTML) 
on a document in this wierd state. Not surprisingly, the call 
document.getElementById
(textareaID) returns null.

Solution: don't create window.dhtmlHistory if you have changed 
document.location, or 
create window.dhtmlHistory before any code that could change document.location.

Original comment by ivani...@gmail.com on 25 Jan 2008 at 5:36

GoogleCodeExporter commented 8 years ago
I am really having some trouble implementing this whole thing.. I have worked 
through some of the issues but the major one now is when i try to call the add  
function like
dhtmlHistory.add("welcome",true);   

and it is throwing the error:
Error: this.storageField has no properties
Source File: http://domain.com/rsh.js
Line: 643

I am still not sure how it knows where #welcome is supposed to go anyways. I 
have 
the ajax working because the ajax calls a content page that figures out where 
to go 
but I can't get the history working. Some help please..

Basically it is a normal homepage but the links change the content div of the 
page 
so the header and footer don't need to reload. All i need to do is be able to 
use 
back. 

Thanks

Original comment by sunitath...@gmail.com on 30 Jan 2008 at 8:08

GoogleCodeExporter commented 8 years ago
Okay I think i finally got things started off working properly it's finally 
putting 
the hash there but it's not changing when I change the page even though I call 
it at 
the top of the php page.

 ?><script>  dhtmlHistory.add("<?echo $page;?>",true);</script> <?   

I can call dhtmlHistory.add more than once right? That's the purpose? It's only 
calling it once or adding a value once because i called 

dhtmlHistory.add("welcome",true); on the first page but then in the content.php 
i 
tried to call
 ?><script>  dhtmlHistory.add("test",true);</script> <?   

and it doesn't change the hash value to test. But if i leave out the welcome 
one it 
makes it test. 

Any assistance?

Original comment by sunitath...@gmail.com on 30 Jan 2008 at 9:07

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I am using Prototype and as I was configuring my app to use RSH I ran into a 
similar error as described above, 
which led me to this posting.  I was seeing storageHash undefined (...has no 
properties, from firebug).  My 
problem was incorrectly configured toJSON and fromJSON functions.  I described 
my findings in the Useage guide  
comments and wanted to drop a note here for anyone else who comes along the 
same way I did.

Original comment by walkerfi...@gmail.com on 30 Jan 2008 at 11:15

GoogleCodeExporter commented 8 years ago
I had this issue, until I figured out that I needed to call the "create" method 
before I started working with the dhtmlHistory object

window.dhtmlHistory.create();

Original comment by ben.a.white@gmail.com on 8 May 2008 at 2:39

GoogleCodeExporter commented 8 years ago
Where exactly did you put the "create" method you used? i keep getting 
"undefined"
content, but no errors in the [mozilla] error console.

Original comment by prideafr...@gmail.com on 26 May 2008 at 12:44

GoogleCodeExporter commented 8 years ago
I agree with ben white.  I was using a different tutorial and it left out the 
line 
window.dhtmlHistory.create();  I downloaded Sergio's tutorial and it also 
leaves 
that line out.  The line of code is shown in the readme.txt that comes with RWH 
and 
it goes right after the includes.

Original comment by titles...@gmail.com on 14 Feb 2010 at 2:56