Using Checkboxes in a LANSA Browse list

If you want to use checkboxes in browse lists with their initial set checked, you will need to deploy the following technique. This technique is based on the preceding example.

<input type=”hidden” name=”__{field name}-<RDML MERGE=”&ROWNUM” FORMAT=4> D”

value=”<RDML MERGE=”{field name}” size=”{size}”>” />

<input type=”checkbox” name=”DUMMY” value=”<RDML MERGE=”{field name}”>”

onclick=”SetCBState(this, ‘__{field name}-<RDML MERGE=”&ROWNUM”

FORMAT=4> D’, ‘Y’, ‘N’)”

<RDML ONCONDITION=”{field name}”>

checked=”checked”

</RDML>

/>

{field name} is the name of the field you have defined in your DEF_LIST command. This {field name} is padded with trailing blanks to 10 characters.

Note that this technique uses the <RDML ONCONDITION> tag to determine the initial state of the checkbox.

This technique calls a different JavaScript function, SetCBState:

function SetCBState(obj, RFld, CY, CN)

{

var NumElements=document.LANSA.elements.length;

for (i=0; i<NumElements;i++)

{

if (document.LANSA.elements[i].name==RFld)

{

if (obj.checked) document.LANSA.elements[i].value=CY

else document.LANSA.elements[i].value=CN;

break;

}

}

}