Is there an api(code)to get question Id? | XM Community
Skip to main content
I see that we can get SurveyID of the survey by using "${e://Field/SurveyID}". Is there an api(code)to get question Id in given page?
In JavaScript the variable this.questionId is the question id.
Thank you TomG. Was aware of this and tried many times earlier. Always giving "undefined". Working on clickNextButton() made me realize that "this" is undefined within your js functions. You need to declare it outside of functions as var that = this and use that.questionId within your javascript functions.
Or you could just define a question id variable at the beginning of your JavaScript:

```

var qid = this.questionId;

```
Hey Sandy, I understand this is an old issue, but I just ran into the "undefined" problem myself. My problem took me 2 tries to run down; JavaScript is a case sensitive language and I'd typed a lower case 'i' in ID; i.e. my variable was "var qid = this.questionid", which will throw a "undefined" every time 🙂 Just wanted to throw this out there in case it was of use to you!

Leave a Reply