I am having a problem with submitting a form that contains required fields. The secenrio is I have two checkboxes and two subforms each subform containing one textfield. The subforms are both hidden. If the user selects checkbox one then subform one becomes visible the textfield one in subform one gets highlited red because it is a required field. If user selects checkbox two then subform two becomes visible and same secenrio with textfield two in subform two. So if user opens form and selects checkbox two then subform two becomes visible and then if user does not enter information in textfield two then you get an error, but if user enters information in textfield two then form should be submitted but it does not submit. The funny thing is checkboxes actually works and everything works ONLY if you go through all the checkboxes selecting and deselecting them form the beginnning. But if you open up the form and only select one of the checkboxes and fill out the texfied it won't submit. I know this sounds a confusing but I dont know how else to put it. I will post the code (using Formcalc) for better understanding.
What I mean is no matter how many fields using the same logic the form does not work the first time you open it. For example if a person opened the form with 5 checkboxes available and only selected the frist 2 and tried to submit the form it won't submit because its still reading the required fields although the subform and the fields associated with it are invisible. But if the user selects and deselects all the checkboxes even the ones the user does not need then logic starts to work and the user can pick which checkboxes they need to check along with associated fields and the form will submit. Bascially the logic only works if you go through all the checkboxes in the begining.
If a field is marked as required then Acrobat is expecting to have a value for it whether it is hidden, visible or invisible. If you do not want this behaviour you will have to adjust the mandatory property of the field along with the presence property when you make it visible/invisible.
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: