How Do I Incorporate JavaScript in the "If" Formula?

  • 28 November 2019
  • 1 reply
  • 0 views

Badge +9

I have a JS in a calculated value that I would like to populate a date field.

 

function setTextBoxDueDate(value) { NWF$('#'+ DueDate).val(value); }

But it doesn't seem to be working properly in the following case. The date field populates but it is ignoring the condition.

 

 

If(SpecialCondition=="Smoke alarms", setTextBoxDueDate(formatDate(dateAddDays(LeaseStartDate, 28), 'dd/MM/yyyy')), "")

 

 


1 reply

Badge +10
After setting the value in the function
NWF$('#'+ DueDate).val(value);
Add this line
NWF.FormFiller.Functions.ProcessOnChange(NWF$("#" + varDueDate));

Make sure that you are getting a proper date in the function

Reply