strange behaviour
hello,
I have something strange happening. I’m using version 6.5.
I have a RadioGroupItem, when I select a value, I have it to be in bold and the other options not. so I modify the ValueMap accordingly.
what is happening is when I modify the display value in the valueMap and I remove the ‘</b>’ at the end, the RadioGroup behaves strangely and when I select an option, another option is selected.
When I modify in anyway the string without removing a portion at the end, it works fine.
in the following code, click on ‘Phone’, then ‘Announcement’ and then on ‘Television’, ‘Phone’ is selected now!
Now, click on ‘Announcement’ repeatedly, the selection toggles now between ‘Phone’ and ‘Television’!
Then, comment the line ‘str = str.substring (0, str.indexOf (“</b>”));’ and try again, everything works fine.
(the problem is that the display value, even if not shown on screen, has a </b> at the end and if we have several clicks, the '</b>'s accumulate at the end)
<HTML>
<HEAD>
<SCRIPT>window.isomorphicDir='../isomorphic/';</SCRIPT>
<SCRIPT SRC=../isomorphic/system/modules/ISC_Core.js></SCRIPT>
<SCRIPT SRC=../isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
<SCRIPT SRC=../isomorphic/system/modules/ISC_Containers.js></SCRIPT>
<SCRIPT SRC=../isomorphic/system/modules/ISC_Grids.js></SCRIPT>
<SCRIPT SRC=../isomorphic/system/modules/ISC_Forms.js></SCRIPT>
<SCRIPT SRC=../isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
<SCRIPT SRC=../isomorphic/skins/SmartClient/load_skin.js></SCRIPT>
</HEAD>
<BODY>
<SCRIPT>
isc.DynamicForm.create({ ID:"radioForm", width: 10,
values: {
"value": "3"
},
fields: [
{showTitle: false, name: "value", type: "radioGroup", vertical:false, valueMap: {
"2": "Saloon","1": "Phone","3": "<b>Television</b>","4": "Announcement","5": "Emailing"
}
,changed: radioChanged
}
]
});
function radioChanged (form, item, value) {
var labels = item.getValueMap();
var str = "";
for (var val in labels) {
str = labels[val];
if (val != value) {
if (str.indexOf ("<b>") != -1) {
str = str.substring (3);
str = str.substring (0, str.indexOf ("</b>"));
}
}
else
str = "<b>" + str + "</b>";
labels[val] = str;
}
item.setValueMap (labels);
form.markForRedraw ();
}
</SCRIPT>
</BODY>
</HTML>