Hide choice display in an in-page display question

huongngohuongngo VietnamCommunity Member Qubie ✭

Hide choice display in an in-page display question

Hi,
I have a multiple choice question that used in-page display logic. I want to hide a choice in that question based on previous answer. However, for in-page display question, choice display can not be used. Can I use javascript for this?
Thank you very much
Huong

Answers

  • rondevrondev Community Member - Trial User Guru ✭✭

    Yes, you can use JS for this. Based on the previous answer event, toggle the choice of this question

  • huongngohuongngo VietnamCommunity Member Qubie ✭

    @ rondev,
    Can you help review my code, it doesn't work. Thank you so much.
    Huong

    var condition_recode = "${q://QID366/SelectedChoicesRecode}";

    if (condition_recode == '6'){
    jQuery("#"+this.questionId+" .Selection").eq(2).hide();

  • huongngohuongngo VietnamCommunity Member Qubie ✭

    Hi,
    I find out that this code work with question without in-page display logic. I am wondering if there is anyway in this case?
    Thank you.
    Huong
    var condition_recode = "${q://QID366/SelectedChoicesRecode}";

    if (condition_recode == '6'){
    jQuery("#"+this.questionId+" li.Selection").eq(2).hide();

  • TomGTomG Raleigh, NCCommunity Member Wizard ✭✭✭✭✭

    @huongngo said:
    Hi,
    I find out that this code work with question without in-page display logic. I am wondering if there is anyway in this case?
    Thank you.
    Huong
    var condition_recode = "${q://QID366/SelectedChoicesRecode}";

    if (condition_recode == '6'){
    jQuery("#"+this.questionId+" li.Selection").eq(2).hide();

    To do it on the same page, you can't use a piped value. As @rondev said, you need to use a JS event handler.

  • huongngohuongngo VietnamCommunity Member Qubie ✭

    @TomG said:

    @huongngo said:
    Hi,
    I find out that this code work with question without in-page display logic. I am wondering if there is anyway in this case?
    Thank you.
    Huong
    var condition_recode = "${q://QID366/SelectedChoicesRecode}";

    if (condition_recode == '6'){
    jQuery("#"+this.questionId+" li.Selection").eq(2).hide();

    To do it on the same page, you can't use a piped value. As @rondev said, you need to use a JS event handler.

    Hi Tom G,
    Thank you for your comment. I think it's not because of the piped text because I piped the text from previous question. Then, I found that it works in the question with in-page display logic when I change the view from horizontal to vertical. I don't know why.
    Thank you for your help.
    Huong

  • TomGTomG Raleigh, NCCommunity Member Wizard ✭✭✭✭✭

    @huongngo said:
    Hi Tom G,
    Thank you for your comment. I think it's not because of the piped text because I piped the text from previous question. Then, I found that it works in the question with in-page display logic when I change the view from horizontal to vertical. I don't know why.
    Thank you for your help.
    Huong

    That's because a horizontal MC uses a table instead of an unordered list. So, "li.Selection" isn't valid for a horizontal MC.

  • huongngohuongngo VietnamCommunity Member Qubie ✭

    @TomG said:

    @huongngo said:
    Hi Tom G,
    Thank you for your comment. I think it's not because of the piped text because I piped the text from previous question. Then, I found that it works in the question with in-page display logic when I change the view from horizontal to vertical. I don't know why.
    Thank you for your help.
    Huong

    That's because a horizontal MC uses a table instead of an unordered list. So, "li.Selection" isn't valid for a horizontal MC.

    Hi Tom G,
    Could you help with this? I know very little about javascript.
    Thank you and best regards,
    Huong

Sign In to Comment