SetOption is not working


Ryan Sytsma

The below code gets 2 values from arrays and then I try to set them to local storage options

The result of the options is not proper. The Key values are not created. They are blank in the browser dev tools window.

The first value for [crew_id] is not set (it has a value) and the value for [crew_name] does get set in local storage.



DecSoft

Hello Ryan,

I hope everything goes fine for you and yours. I can't reproduce the problem that you mention. The below code works as expected:

Look in your code for some possible typo errors, because, you must remember that JavaScript is case sensitive. There is a problem in your code in the below line:

Note that the last argument must be "String".



Ryan Sytsma
Amazing, sometimes my 2 year old will walk over and start typing on my keyboard! Must be what happened. I will test again. Thanks

Ryan Sytsma

Here is my test

DebugAlert is my own function

All values are present in my alerts. Only the SetOption for crew lead id is getting set right. The other two are not setting at all



DecSoft

Hello Ryan,

Maybe you already use a variable name "current_crew_name" or "current_crew_lead_id" previously used in the app? It's the only think that I can think right now... so you can maybe try with options names like "__current_crew_name" and "__current_crew_lead_id", just to assert that that names are not already used for any variable in the app.



Ryan Sytsma

it was a variable naming issue

Thanks for your help and I hope you are staying healthy under these strange times



DecSoft

No problem! And the same for you and yours, Ryan, stay safe! :-/



Ryan Sytsma

If a local storage option does not hold a value or does not exist, will it be null or undefined?



DecSoft

Hello Ryan,

If the option that we are trying to get do not exists what we get is an empty string.



Ryan Sytsma
So I could check it with StrLen or see if it is ""

DecSoft

Hello Ryan,

Yes; both ways can be fine.


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.