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.
SOLVED

Email Form

Avatar

Level 3

Hello,

I have an email form for error page. There are name, email and comment field in page. The email works perfect and send values by email.

I need to have 2 more fields which are hidden and report the broken link/unvalid url in our site and Ref URL the website which has link to this broken link.

Could you please let me know what is the best approach to add these 2 hidden field. I have created hidden fields, but I am not sure how to get those information in my email.

Frankly, where should I put my javascript for those fields:

<script type="text/javascript">

document.errorform.BrokenLink.value = window.location.href;

document.errorform.RefURL.value = document.referrer;

</script>

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Just put that hidden form code in the JSP that posts the form fields to AEM. It would be the same way as posting any hidden form field to a server. See this StackOverflow thread for more information on how to post hidden fields:

http://stackoverflow.com/questions/9251301/how-add-new-hidden-input-fields-to-the-form-on-submit

You can always write your own form component and submit the data (including hidden form fields) to an AEM Sling Servlet too:

http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Just put that hidden form code in the JSP that posts the form fields to AEM. It would be the same way as posting any hidden form field to a server. See this StackOverflow thread for more information on how to post hidden fields:

http://stackoverflow.com/questions/9251301/how-add-new-hidden-input-fields-to-the-form-on-submit

You can always write your own form component and submit the data (including hidden form fields) to an AEM Sling Servlet too:

http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html