I know this is an old case, but I have the same requirement and have been unable to find a successful solution in my research. I have a radio button which allows the user to select the criteria they want to use to run a report. The first option is using a begin and end date. The second option is to enter in a specific contract id. If they select the first option I check the value of the radio button and will show the calendar controls and hide the contract id control (edit box). What I also want to do is to toggle the controls to be required or not depending on the selection. If they select the dates option, then the dates would be required and the contract id would not be required. I've tried using java script to toggle the required attribute as I can't find anything in the webfocus functions to do this. If I set the date controls to _FOC_NULL for example when the user clicks on the Contract ID selection option, and the focexec runs ok but if they click back on the Dates option, the actual word "_FOC_NULL" shows up in the calendar text box.
I am not javascript savvy so I may have numerous things wrong with this function and I have lots of alerts in it (don't laugh) .... but here is the code.
function showSelOption(event)
{
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here
var test2 = [];
var test2 = IbComposer_getCurrentSelection('radio1Grp');
if (test2 == 'DATES')
{ alert("in dates")
begdateCntl.setAttribute('required','required');
enddateCntl.setAttribute('required','required');
contidCntl.removeAttribute('required');
IbComposer_triggerExecution('showDates');
IbComposer_triggerExecution('hideContid');
IbComposer_setCurrentSelection('contidCntl','_FOC_NULL', false);
var begdateb1 = IbComposer_getCurrentSelection('begdateCntl');
var enddateb1 = IbComposer_getCurrentSelection('enddateCntl');
alert("begdateb1")
alert(begdateb1)
alert("enddateb1")
alert(enddateb1)
alert("contidCntl")
alert(contidCntl)
} else if (test2 == 'CONTID')
{
var begdateb2 = IbComposer_getCurrentSelection('begdateCntl');
var enddateb2 = IbComposer_getCurrentSelection('enddateCntl');
alert("begdateb2")
alert(begdateb2)
alert("enddateb2")
alert(enddateb2)
begdateCntl.removeAttribute('required');
enddateCntl.removeAttribute('required');
contidCntl.setAttribute('required','required');
IbComposer_triggerExecution('hideDates');
IbComposer_triggerExecution('showContid');
IbComposer_setCurrentSelection('begdateCntl','_FOC_NULL', false);
var begdatea2 = IbComposer_getCurrentSelection('begdateCntl');
alert("begdatea2")
alert(begdatea2)
IbComposer_setCurrentSelection('enddateCntl','_FOC_NULL', false);
var enddatea2 = IbComposer_getCurrentSelection('enddateCntl');
alert("enddatea2")
alert(enddatea2)
}
}
//End showSelOption
WF 8.2.4 Windows
Mainframe
Oracle/DB2/SQL Server
App Studio
Tomcat/Servlet