I need to create anchor tag on Sitecore Form Submit Button that will have mailto added. How to achieve this.
3 Answers
First, you need to design your form like which field you want to add. You can check this document https://doc.sitecore.com/xp/en/users/90/sitecore-experience-platform/the-form-elements.html
Once the form will be designed then you need to add Submit actions
and in Submit action
you can set "To, From, Subject, Body". For more detail you can check here https://doc.sitecore.com/xp/en/users/101/sitecore-experience-platform/working-with-submit-actions.html in the section "Send Email".
If you want to create custom action then follow this document https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-manager/walkthrough--creating-a-custom-submit-action.html
You can achieve this by creating a custom Submit button that will be a copy of the OOTB submit button. Follow these steps.
- Under this path
/sitecore/system/Settings/Forms/Field Types/Structure
, create a copy of Submit Button called CustomButton. - Create a copy of file Button in this location
\inetpub\wwwroot\<your-solution>\Views\FormBuilder\FieldTemplates
- The item we have created in step 1, in the View Path field add the view path of your new file like
FieldTemplates/CustomButton
- Now on your view file, write the code to make it an anchor.
Follow this for more details.
https://smartsitecore.com/en/call-custom-javascript-on-sitecore-forms-submit/
Hope this helps.
When setting up a new sitecore form, you must first specify the data you wish to collect.
For example, 'name', "message', 'phone number'. You then need too drag the relevant input elements onto the page to collect that data and give them appropriate labels. In addition to those you need to add a submit button.
The last stage is to then define what you want to do with the data once collected. In sitecore forms, you have something called 'submit actions'. One such action allows you to email the content of the form to an email address of your choosing. I believe this action would achieve what you are looking for.