artdocent Posted August 6, 2014 Report Share Posted August 6, 2014 In one of my submission forms, users are allowed, but not required, to select an alternate date. In the acknowledgment email, I'd like to hide the alternate date details if one isn't selected. Is this possible? Thanks! Quote Link to comment Share on other sites More sharing options...
Jan Posted August 7, 2014 Report Share Posted August 7, 2014 Hello artdocent, If I understand correctly, what your goal is, you can try following steps: 1) Add a Rule: if a user does not select the check box, hide fields of alternate date. 2) Create Hidden virtual fields, where labels of the alternate date fields will be placed; 3) Insert in Acknowledgment email the code like: [@cbParamVirtual1] <cb:field name="secondaddress"/>[@cbParamVirtual2] <cb:field name="thirdaddress"/> If a user does not select to fill alternate date, the virtual fields and values of entered fields will be empty, so nothing will be displayed in the email. 4) Add a Header&Footer element and then enter the code like: <SCRIPT LANGUAGE="JavaScript"> function setFields() { var isSet = document.getElementById("InsertRecordthesameaddress").checked; if (isSet) { document.getElementById("cbParamVirtual1").value = "second address:"; document.getElementById("cbParamVirtual2").value = "third address:"; } } document.getElementById("caspioform").onsubmit = setFields; </SCRIPT> Please enter your field instead of thesameaddress in InsertRecordthesameaddress. And enter your labels for Virtual fields instead of "second address:" and "third address:" I worked with two fields, but you can add as many as you want. Now, if a user selects the check box, labels and values will be added to the email. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
artdocent Posted August 11, 2014 Author Report Share Posted August 11, 2014 This worked great! Thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.