var mypref = load('myprefs'); chokes JIN

2 views
Skip to first unread message

mapicurious.com

unread,
Mar 25, 2008, 9:44:29 AM3/25/08
to WHERE GPS Developers

My goal in the below function is to load a previously saved
preference, and pass that as part of the form action.

The problem results when a first time user loads the app or clears the
cache, and therefore does not have the preference set. Ideally this
should just pass '' to the variable, however it causes JIN to choke.

Is there a valid test (isAvailable) I can use to test?

If I add save('myprefs',''); before loading, it obviously would erase
previous preferences - but the code would work!


function doSubmitForm() {
var mypref = '';
mypref = load('myprefs');
var formObj = document.testform;
formObj.action = 'http://www.cnn.com/where/jin?prefs=' + mypref;
formObj.submit();
}

Thanks,

Brad

mapicurious.com

unread,
Mar 25, 2008, 12:13:29 PM3/25/08
to WHERE GPS Developers
Inserting the following code seems to solve the issue:

if(load('myprefs') != null)  
{ mypref = load('myprefs'); }
Reply all
Reply to author
Forward
0 new messages