I've got t:select with two values - CHANNELS, WIDGETS. If I choose first one, I will display palette with all channels and hide widgets palette (both in zones), if I select second one, I will hide channels palette zone and display widgets palette zone. Both palettes are pre-selected with items loaded up from database. Both selectedWidgets, selectedChannels are annotated as @Persist. Problem is that customer wants to delete selected widgets, then switch to channels and add them, so two operations. If he then saves, deleted widgets are still there and channels are added correctly. Is this is possible to solve it?
If I understood correctly you need to save values for both palettes on form submission. So both palettes should present on the form.
To solve this you can just hide one palette and show another on select value change. No server-side operation is needed (and zones is not needed too):
<t:select t:id="select" .../>
<t:palette id="widgets" .../>
<t:palette id="channels" .../>
And js using jquery:
var $select = $('#' + selectId);
var $widgets = $('#' + widgetsId);
var $channels = $('#' + channelsId);
$select.on('change', function() {
if ($select.val() == 1 /* or another value corespondent to channels */) {
$widgets.hide();
$channels.show();
} else {
$widgets.show();
$channels.hide();
}
});