


Hello,
I have a form which has several checkboxes. A couple of them requires a date field to be entered in a box next to it. If the user checks the box which has a date field box next to it, I want the form to do the following:
1. Let the user know that they have to enter/pick a date for that box. The JavaScript I entered is below.
2. Stop the user from sending the form via email, printing the form and saving the form if the date is not entered in the box.
I entered the below JavaScript in the click event of the checkbox. I found it on the internet and it doesn't seem to work. FYI - I changed the value of the date field boxes to "user optional" and then I changed it to "user required" and it still does not work like I want it. Can anyone help?
if(this.rawValue == 1)
{
this.parent.warrant.mandatory = "error";
}
else
{
this.parent.warrant.mandatory = "disabled"}
Thank you.
Views
Replies
Total Likes
Not sure where you got this sample script from but it is not completely correct 🙂
Here is my sample form
The logic is in the check box and looks like this:
if (this.rawValue == 1) {
DateField1.validate.nullTest="error";
} else {
DateField1.validate.nullTest="disabled";
}
The result is: the moment I check the box the associated DateField1 becomes mandatory and depending on your Reader settings a red frame shows up:
and when you try to submit it will reject
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Ok, several things:
If you use this PDF in Adobe Reader you will need to have Reader Extensions applied either by using Acrobat Pro or AEM Forms server software - otherwise it will not allow to submit the entered data.
The logic I showed you will only change the state of the field from non-mandatory to mandatory and back and must be in the change event of the check-box - I realized that I did not mention that.
The Send as Email functionality of Reader will also heed the mandatory state of the fields (if they are mandatory) - there should not be a difference to using the Email Submit button.If your logic fails to make a mandatory field mandatory then it is no surprise that it will send the E-Mail right away.
Here is my sample for download https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:2302891b-1ad4-45b7-956b-4df43bb7344...
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Ok, I show you how the form works here. The Submit button is hidden, I use the E-Mail button upper right only:
No Checkbox selected - means no mandatory - E-Mail can be sent:
Checkbox selected - means mandatory field - no email can go out unless you fill the field:
Date filled, E-Mail button clicked, E-Mail can be sent.
I cannot explain why this is NOT working for you unless you have made a mistake in your implementation. Did you try my sample not using the Submit button on the form?
Views
Replies
Total Likes