Skip to main content
Participant
Aug 14, 2025 1:34 PM UTC
Answered

Formula for 90 days and IF radio button selected

I need help formatting the following scenario: 

 

90 days from the date entered, if radio button DOB is selected. 

 

I have the formula to do 90 days, but can't figure out the "If DOB is selected"

 

var date = util.scand("mm/dd/yy", event.value);
if(event.value == "")
this.getField("90days").value = "";
else {
date.setDate(date.getDate() +90);
this.getField("90days").value = util.printd("mm/dd/yy", date);}
 

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
Aug 14, 2025 2:45 PM UTC

Is DOB radio button choice?
If yes, then use like this (change "Group1" to your radio button name):

var date = util.scand("mm/dd/yy", event.value);
var rb = this.getField("Group1").valueAsString;

if(event.value == "" || rb != "DOB")
this.getField("90days").value = "";
else if(event.value && rb == "DOB"){
date.setDate(date.getDate() +90);
this.getField("90days").value = util.printd("mm/dd/yy", date);}

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
Aug 14, 2025 2:45 PM UTC

Is DOB radio button choice?
If yes, then use like this (change "Group1" to your radio button name):

var date = util.scand("mm/dd/yy", event.value);
var rb = this.getField("Group1").valueAsString;

if(event.value == "" || rb != "DOB")
this.getField("90days").value = "";
else if(event.value && rb == "DOB"){
date.setDate(date.getDate() +90);
this.getField("90days").value = util.printd("mm/dd/yy", date);}
Translate
Legend
Aug 14, 2025 1:57 PM UTC

Hi @ashlyn_6111, 

 

Thanks for reaching out. Adobe does not provide support for JavaScript; wait for input from experts. 

My understanding of the question:

To make the calculation only work if the “DOB” radio button is selected, you can add a condition to check the radio button’s value before running your +90 days code. Given the screenshot attached.

 

Here’s an example JavaScript you could use in the custom calculation script for the “90days” field:

 

// Get the selected radio button value

var focusChild = this.getField("Focus Child").value; // Change name to match your radio button group field name

 

// Only run if DOB is selected

if (focusChild === "DOB") {

    var dobValue = this.getField("DOB_Date").value; // Change to match your DOB field name

    if (dobValue !== "") {

        var date = util.scand("mm/dd/yy", dobValue);

        date.setDate(date.getDate() + 90);

        event.value = util.printd("mm/dd/yy", date);

    } else {

        event.value = "";

    }

} else {

    event.value = "";

}

 

What you’ll need to adjust:

  • Replace "Focus Child" with the actual radio button group name in your form.

  • Replace "DOB_Date" with the actual name of the DOB date field.

 

 

If you want, I can rewrite this exactly to match your field names so you can just paste it in without trial and error. Can you tell me the exact field names for:

  1. The radio button group

  2. The DOB date field

  3. The 90-day output field

Let us know how it works. And wait for more inputs from experts.



Best regards,
Tariq | Adobe Community Team

Translate