How to get stored value in MultSelect CheckBox in reactive
Question
Application Type
Reactive

Hi,

In my screen [Search Screen] I have Input, checkbox and MultiSelectionCheckbox widgets.  I enter  / select some input in these widgets and click on "Find" Button" and I get the relevant data on "Result Page". 

From my "Result Page" I have "Previous" HyperLink. When I click I come back on "Search Screen" and here I show what you entered / select for your previous search. For that I stored the input in Client Variable and I get the entered values only for input and checkbox widget. But I want to show MultiSelect CheckBox's value as well. Because I can select one or multiple options. Those selected option I want to show when I come back on Search screen.

Can somebody help me.


Thanks

Hi @NathanAstel,

In this case, you have to create a client variable with the text data type, then you have to concat or use "String_Join" action to join multiselect checkbox values into one text variable with "," separator and assign the same to created client variable on OnChange action. This will store all the selected values in text format with a comma separator.

When you are clicking "Previous" hyperlink,  split the text to list back using "String_Split" action using "," separator. 

Good luck!!

Thanks, Aadhavan S

Hi,

I stored selected values like this 

var output = [];

$('.SelectedList > span ').each(function(){

//alert($(this).text())

output.push($(this).text().replace(/,/g, ""));

});

$parameters.SelectedValues = "Selected Dealers :-"+output, 1, true, "", false;


This is mentioned in the demo. Values stored in Client Variable. But again when come back on this page again then I unable assign the stored values to  Multi Select CheckBox

$('.SelectedList > span ').text($parameters.MyList);


mvp_badge
MVP

Hi NathanAstel,

I have tried to implement the mentioned use case, and below are my observation & solution.

See this demo screen RWA | MultiSelectDemo

  • You will have to define a Client variable to hold the selected option Ids as a comma-separated string value (Use String_Join server action from Text extension module).
  • Define the OnAfterFetch action to the data source action mapped with the MultiSelect block. Check the client variable value (Use String_Split server action from Text extension module) within the action flow and set the IsSelected boolean attribute value accordingly.
  • I have observed that the OnChange handler of the MultiSelect block gets executed automatically after every page load, which resets the client variable assigned within the handler flow. Therefore, I have introduced an additional boolean flag variable called isFirstCall with a default True value to check & handle this condition.

Refer to the attached .oml file.


I hope this hels you!


Kind regards,

Benjith Sam

RWALabMultiSelectRetainValueDemo.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.