Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

checkbox to populate email address script

Avatar

Former Community Member

I have a form and when bind the value to "on" and populate with an email address this is fine. However when I don't check the box my outlook does not recognise " " or null. I am basic with scripting can anyone please help?

Dunc

1 Reply

Avatar

Level 7

Not sure how you're sending the email request, but here's a script for a button that takes its subject from a text field and takes its To: address from a checkbox with an address for the on value and empty string for off value.


var subject = TextField1.rawValue;


var email = (Checkbox1.rawValue == null) ? "" : CheckBox1.rawValue;



event.target.mailDoc({


  bUI: false,


  cTo: email,


  cSubmitAs: "pdf",


  cSubject: subject


});


750480_pastedImage_0.png

750481_pastedImage_1.png

750491_pastedImage_2.png