Javascript code for submit email based on dropdown selection

Avatar

Avatar

KSBarton

Avatar

KSBarton

KSBarton

08-04-2019

I'm using the new Adobe AEM Designer, similar to the Adobe LiveCycle.

I have 2 drop down list: One for District and 1 for County.

District has switch code to populate the 2nd drop down list which is the counties they can select within that district.

I also have a submit button that upon clicking the button, will email the form to the email that's associated with the county that is selected.

I'm not sure how to get the submit button to send the PDF via email based on the email address associated with the county they selected.

Any suggestions are welcome.

Thanks,

KB

View Entire Topic

Avatar

Avatar

KSBarton

Avatar

KSBarton

KSBarton

22-04-2019

Changing "recipient_email" to "am_email", if the am_email is empty or blank use another email, how would I fix this? How doI turn this into a switch? I have 159 counties and  a different email for each county. Some will have the first email (am_email) option blank/empty so it will have to go the second email (dsm_email)

var am_email = "default_am_email@this_could_be_empty.too"

var dsm_email = "default_dsm_email@this_could_be_empty.too"

var county = this.getField("County").value

if (county == "county_A"){

  (am_email = "info@countyA_am.net") or (am_email = "null")

  }else if(dsm_email == "info@countyA_dsm.net"){
}

else if(county == "county_B"){

  (am_email = "info@countyA_am.net") or (am_email = "null")

  }else if(dsm_email == "info@countyA_dsm.net"){
}