Copy link to clipboard
Copied
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 .
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Has the text box a name with a space at the end or not?
Copy link to clipboard
Copied
No , that was a typo from poying and pasting over , my apologies .
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
Yes, use it at validation of the dropdown.
What happens when you use it?
Copy link to clipboard
Copied
Nothng , i was getting syntax errors but those have since been corrected . Adobe is accepting of the scropt but nothing populates in "Calc_Text"
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you , that worked!!! 🙂
Copy link to clipboard
Copied
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 ";
Copy link to clipboard
Copied
If you want to use rich text in "Calc_Text" field, there is no need to turn on rich Text in event field, so delete this line:
event.target.richText=true;
Go to "Calc_Text" field properties and turn on 'Allow Rich Text Formatting' under 'Options' tab.
Replace this:
r.value =
spans = new Array();
with:
var spans = new Array();
To set spans to "Calc_Text" replace this:
event.richValue=spans;
with:
r.richValue=spans;
Test those changes and let me know if it works.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more