Skip to main content
Known Participant
August 2, 2024
Answered

Drop down selection triggers predefined text in text box

  • August 2, 2024
  • 2 replies
  • 1107 views

Good morning all , i was hoping to get tome guidance on this . 

I am creating a form that when a drop down selection is made it will trigger a predefined response in anouther text that pulles its information from other form fields .

My dropdown is "DD_Income_change" and the text box is "Calc_Text"

My other fields of information are "StartRent", "EndRent", "Date36_af_date", and "MonthlyIncome"

 

I have come up with the following DD Valadation Script and was hoping someone could review it and see where i went wrong.

 

"var s = this.getField("StartRent").valueAsString;

var e = this.getField("EndRent").valueAsString;

var d = this.getField("Date36_af_date").valueAsString;

var i = this.getField("MonthlyIncome").valueAsString;

var r = this.getField("Calc_Text ").value;

if(event.value == "Income Increased/Decreased")

r.value = " Effective "+ d +", your potion of rent will be changing from $"+ s +" to $"+ e +". Please pay the amount of $" + e + " on the 1st of the month." +

"This adjustment is due to your monthly reported income of $"+ i +".";

else if(event.value == "No Change")

r.value = " Due to your monthly reported income of $”+ I + “, your monthly rent will not be changing. Please pay the amount of $”+ e +” on the 1st of the month.”;

else r.value = "";      "

 

Thank you for your time . 

This topic has been closed for replies.
Correct answer Nesa Nurani

Change this:

var r = this.getField("Calc_Text ").value;

to this:

var r = this.getField("Calc_Text ");

 

Also in "No Change" condition, change variable name I to i.

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
August 2, 2024

Change this:

var r = this.getField("Calc_Text ").value;

to this:

var r = this.getField("Calc_Text ");

 

Also in "No Change" condition, change variable name I to i.

CMunro87Author
Known Participant
August 2, 2024

Thank you , that worked!!! 🙂

CMunro87Author
Known Participant
October 8, 2024

Thank you Again @Nesa Nurani for your help . Im trying to apply principle this to a different form with formatting I have placed the scipt in the custom validation . Once the onformation is entered and the dropdown selected nothing populates in the "Calc_Text" Field. Would you mind looking it over for me ? 

 

event.target.richText=true;

var w1 = this.getField("DD_Writer").valueAsString;
var w2 = this.getField("Calc_WriterPosition").valueAsString;
var w3 = this.getField("Calc_WriterPhoneNumber").valueAsString;
var w4 = this.getField("Calc_WriterEmail").valueAsString;
var m1 = this.getField("Date_LetterDate").valueAsString;
var m2 = this.getField("ResidentName").valueAsString;
var m3 = this.getField("DD_Property").valueAsString;
var m4 = this.getField("Date_AptDate").valueAsString;
var m5 = this.getField("DD_Time").valueAsString;
var m6 = this.getField("Date_IncreaseDate").valueAsString;
var r = this.getField("Calc_Text");

if(event.value == "VCL Attempt #1"){
r.value =

spans = new Array();
spans[0] = new Object();
spans[0].text = m1 + "\n\n\n\nDear, " + m2 +
"\n\nThank you for being a valued resident at " + m3 + "." +
"\n\nIt is time for your annual review. As you may remember when wntering the " + m3 + " Program, you were advised that every year we would review your income and adjust your rent as needed. This is required for every resident in the program. Although, rent adjustments may have reciently orrurred, it is required by our contract to review everyone's income at their annual annaversary.";

spans[1] = new Object();
spans[1].text ="\n\nI have schedueled a time for youto come to the office and complete this process on ";
spans[1].fontWeight=900;

spans[2] = new Object();
spans[2].text = m4 + " At " + m5 + ".";
spans[2].fontWeight = 900;
spans[2].underline = true;

spans[3] = new Object();
spans[3].text ="\n\nIf you fail to complete your recertification and provide the requested documentation by that date, your rent will revert to market rate of $650.00 effective ";
spans[3].fontWeight=900;

spans[4] = new Object();
spans[4].text = m6 + ".";
spans[4].fontWeight = 900;
spans[4].underline = true;

spans[5] = new Object();
spans[5].text ="\n\nIf at any time your income frcreases and it is expected to stay that way for at least one month, we will adjust your income immediately. Should your income increase at any time , please notify us immediately. Failue to notify us of income changes may resulyt in back rent owed and late fees." +
"\n\nIf you have any questions on this regarding the income review or any other program policies, please contact your case manager." +
"\n\n\n\n\n\n" + w1 +
"\n" + w2 +
"\nValley Cities Behavioral Health Care" +
"\nCell: " + w3;

event.richValue=spans;
}
else if(event.value == "Others Attempt #1")
r.value = "this part works so far";

else r.value = "hello this is blank ";

Bernd Alheit
Community Expert
Community Expert
August 2, 2024

Has the text box a name with a space at the end or not?

CMunro87Author
Known Participant
August 2, 2024

No , that was a typo from poying and pasting over , my apologies . 

CMunro87Author
Known Participant
August 2, 2024

Am i correct in thinking that this needs to be a validation script in the DD box or do i need to put my formula in the the text box ?