How do I write to browser variables / session storage?

I can see how to retrieve these variable’s values in action rules, but how do I write to them in the first place?

Reference is made to a video on a help page (Use browser local and ... | Tadabase) but there is no video.

In a recent Office Hours I asked about this feature and was told it was ‘there’, but how do I use it please?

@brettlewis this option is only available on the details component.

Inside any details component, you can save the value being shown to a custom Local Storage variable. Just remember the name you use for the variable, it will be required in your action links. Case sensitive.

You can confirm that its saved by looking in the developer console:

For now this only works in the details component, but you can easily save any values using Javascript too. Let me know your use case and I’d be happy to explain further.

1 Like

From the details component, it seems that the value is written to Browser Local storage and not Session storage. How do we write it to session storage?

There’s no way to write to Session Storage using this method, but you can do so easily with a bit of Javascript:

Suppose my Details component is component_3 and the field I want to write is field_41 (it must exist inside the component).

TB.render('component_3', function(data) {
	sessionStorage.setItem("industry", data.record.field_42);
});

Keep in mind, you can see everything that’s in the component by adding this line:

TB.render('component_3', function(data) {
	console.log(data.record);
	sessionStorage.setItem("industry", data.record.field_42);
});

@brettlewis I believe this is the video that was referenced.

Build it with Tim - How do I save values to local storage? (Ep. 13)