Advertisement
alamin_89

Integrate Calendly with Contact Form 7

Feb 27th, 2023 (edited)
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Source From Here https://codepen.io/calendly/pen/KKPzNrB
  2.  
  3.  
  4. <!-- Calendly CSS and JS -->
  5. <link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">
  6. <script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>
  7. <div id="calendlybooking"></div>
  8.  
  9. <script>
  10.  
  11. // Builds the correct URL to pass into the Advanced Embed Code
  12. const buildURL = () => {
  13. var teamPage = "company Name";
  14. var eventType = "30min";
  15. return (generatedURL = "https://calendly.com/" + teamPage + "/" + eventType);
  16. };
  17.  
  18. // Show Hide the Custom Form
  19. const hideForm = () => {
  20. document.getElementById("package-form-total-wrapp-id").style.display = "none";
  21. };
  22.  
  23. const showCalendly = () => {
  24. // Call the "Build URL" function
  25. buildURL();
  26.  
  27. // Call the "Hide Form" function
  28. hideForm();
  29.  
  30. // Initialize Calendly Embed
  31. Calendly.initInlineWidget({
  32. url: generatedURL,
  33. parentElement: document.getElementById('calendlybooking'),
  34. prefill: {
  35. name: document.getElementById("namebook").value,
  36. email: document.getElementById("emailbook").value
  37. }
  38. });
  39. };
  40.  
  41. document.addEventListener( 'wpcf7mailsent', function( event ) {
  42.  
  43. showCalendly();
  44.  
  45. }, false );
  46.  
  47. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement