Using Javascript to embed Calendly in a survey

170 Views Asked by At

I'm using REDCap 13.9.3.

I'm trying to embed Calendly in a survey so participants can schedule their own appts and for some reason, I can't make the Javascript Injector work. Sorry about the basic question, but where am I supposed to put the src code? It can't be placed on the field itself since redcap fields can't accept tags, and it doesn't work if I put it as a snippet in the Javascript injector itself. I know I have the right settings because I tried it with an online tester and my calendar shows up:

calendly testing on https://jsfiddle.net Calendly on RedCap problem

Edit: the snippet works fine and for some reason Calendly wasn’t loading at that point. It works fine if you inject the Javascript code in a snippet and create a div with that id in the REDCap field.

1

There are 1 best solutions below

3
Jangari On

First, I note that you have also asked this in the REDCap Community and I can see you're getting good help there. But for others who may come across this, I think injecting JavaScript might be overthinking this.

Did you know that you can use the video embed function in a descriptive text field to embed any webpage in a REDCap form/survey?

If your Calendly booking system has a single URL (which I guess is the "url" attribute in your Calendly.initInlineWidget options object), then first try putting that in the Video URL field in a descriptive text field. Both inline and popup options should work for you.

Here's an example I knocked up with a Google Appointment Booking form. Same thing really. It just loads the URL in an iFrame.

enter image description here