Selecting entries from a tabbed container

I have a tabbed container with 3 choices and an OK button to the right (see screen capture).

I am not clear on the code for the OK button which needs to recognize which Remark was selected.

The code for Remark1 would be

localStorage.setValue('mRemark1', textInput43.value)

The code for Remark2 would be

localStorage.setValue('mRemark1', textInput44.value)

I just need to know how the OK button would know which code to use.


Select the component you want more details on (tabs1) then check the State on the left pannel for more details.

In the screenshot, the current selected tab is 'View 1'. If you want to check which tab is selected, you can use tabs1.value === 'View 1', it would return true.

Assuming the tabs component you have is tabs1 and the key for the tabs is mRemark1, mRemark2, mRemark3. You would use tabs1.value === 'mRemark1', tabs1.value === 'mRemark2', tabs1.value === 'mRemark3'. They should return true depending on which tab is selected.

I am new to this type of code. From my research, the best code I can come up with under the OK button is:

if tabs2.value === "Remark 1" then localStorage.setValue('mRemark1', textInput43.val);
elseif tab2.value === "Remark 2" then localStorage.setValue('mRemark1', textInput44.val);
else localStorage.setValue('mRemark1', textInput42.val);
end if

Unfortunately this doesn't work.

I have included some screen captures to clarify my screen environment.

Could you offer any suggestions?


try this block of code instead.

let saveRemark = "";

if(tabs2.value ==="Remark 1")
	saveRemark = textInput43.value;
if(tabs2.value ==="Remark 2")
	saveRemark = textInput44.value;
if(tabs2.value ==="Remark 3")
	saveRemark = textInput42.value;

localStorage.setValue('mRemark1', saveRemark);

Thank you so much. It works perfectly.
I will mark this as a solution.
I really appreciate your help.

1 Like