If you are using js. Then you can create simply create variable under your code.
Var variableName='${q://QIDX/enteredText';
You can refer below link to get the piping text.
https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/piped-text-overview/
@ArunDubey Thanks for the reply!
Unfortunately, the code for embeding YouTube videos and the YouTube video URLs themselves are different.
For example, someone could copy and paste the following link to Fleetwood Mac’s song: “ https://www.youtube.com/watch?v=WM7-PYtXtJM
But to EMBED it, the code looks like this: <iframe width="560" height="315" src="https://www.youtube.com/embed/WM7-PYtXtJM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
You’ll notice some differences (e.g., “embed” in between “.com/” and “?v=”
This is why I can’t just insert the same piped text.
You can split the link into array using split('/') function then can try to change the value in between and recreate the link again using /.
Also you can simply replace the link parameter. Please refer this stackoverflow link and check if it can help you.
https://stackoverflow.com/questions/7171099/how-to-replace-url-parameter-with-javascript-jquery
Hi @boothieresearcher ,
I have created code which works with different lengths and type YouTube links and stores
ID value in an embedded data which can be piped anywhere :
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
let textInput = document.getElementById("QR~QID96");
let nextButton = document.getElementById("NextButton");
textInput.addEventListener("input", function() {
let text = textInput.value;
let regex = /^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.?be)\/(?:watch\?v=|embed\/|v\/)?()\w-]+)/;
let isValidYouTubeLink = regex.test(text);
if (isValidYouTubeLink) {
console.log(text);
let match = text.match(regex);
let youtubeID = match && matcht1];
console.log(youtubeID);
Qualtrics.SurveyEngine.setEmbeddedData('youtubeID', youtubeID);
nextButton.disabled = false;
} else {
nextButton.disabled = true;
}
});
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
It also disables the Next button if a valid YouTube link is not pasted.
Hope this resolves your query!!
@boothieresearcher , this is such a cool idea! Way to put the “experience” of your survey-taker to the forefront!