Okay well that statement makes sense but I was still curious because I know it is all about the scripting and I know there is the right script out there to do this, so I still kept searching and I found it. You just have to add a validate link with the checkbox so my scripts for the two checkboxes are as follows:
if (AccruedAnnualLeave ==0) then
form1.page1.sub1.presence = "invisible";
form1.page1.sub1.AccruedAnnLvFromDate.presence = "invisible";
endif
if (AccruedAnnualLeave ==1) then
form1.page1.sub1.presence = "visible";
form1.page1.sub1.AccruedAnnLvFromDate.presence = "visible";
form1.page1.sub1.AccruedAnnLvFromDate.validate.nullTest = "error"
endif
if (RestoredAnnualLeave ==0) then
form1.page1.sub2.presence = "invisible";
form1.page1.sub2.RestoredAnnLvFromDate.presence = "invisible";
endif
if (RestoredAnnualLeave ==1) then
form1.page1.sub2.presence = "visible";
form1.page1.sub2.RestoredAnnLvFromDate.presence = "visible";
form1.page1.sub2.RestoredAnnLvFromDate.validate.nullTest = "error"
endif
With this script my form is working correctly, as you see you need to add the validate.nullTest code to get it working properly. I found this code and many others at
http://www.adobe.com/devnet/livecycle/designer_scripting_samples.html#changing_appearanceI hope this will help others in the future.