Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
This is the place for questions about learning design and pedagogy; how to use different page types for different purposes.
  • Page:
  • 1

TOPIC:

Restart button in the Gap Fill page type 6 years 10 months ago #4938

  • annem
  • annem's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 177
  • Thank you received: 0
Hi All,
Hopefully you can help me.

I have been asked if it is possible to add a 'Restart' button (like the Retart button in the Decision Tree page type) in the 'Gap Fill' page type?

Can a code be written in the script?

I look forward to hearing from you.
Anne

Please Log in or Create an account to join the conversation.

Last edit: by annem.

Restart button in the Gap Fill page type 6 years 10 months ago #4948

  • Fay
  • Fay's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 229
  • Thank you received: 92
Hi Anne

You'd have to add a script to add a restart button and then have some code that restarts the activity when it's clicked.

This works on the version I'm running but may need some changes for your install (the gap fill page has slightly changed recently to fix some bugs):
$("#mainPanel").append('<button id="restartBtn">Restart</button>');

$("#restartBtn").button().click(function() {
  // change the variables storing when the activity is complete etc.
  currvalue = undefined;
  correct_answers = 0;
  total = 0;
  labelAnswers = {};
  $("#pageContents").data({ "score": 0, "attempts": 0 });

  // then reset what's on screen
  $("#targetHolder input")
     .val('')
     .attr("readonly", false)
     .addClass("incorrect");

  $("#pageContents").find("#hint").remove();
  $("#feedbackTxt").hide();
});
The following user(s) said Thank You: annem

Please Log in or Create an account to join the conversation.

Restart button in the Gap Fill page type 6 years 10 months ago #4950

  • annem
  • annem's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 177
  • Thank you received: 0
Hi Fay,
Thank you for the code.

I guess that if I add this code or suggest to the academic that they add the code, when the new Xerte version install takes place, there could be a problem with the customisation of that page type? Will the upgrade version overwrite it?

Best wishes
Anne

Please Log in or Create an account to join the conversation.

Restart button in the Gap Fill page type 6 years 10 months ago #4952

  • Fay
  • Fay's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 229
  • Thank you received: 92
If you add the code to the script field in the projects the academic is working on then it will work after upgrade & won't be overwritten. It's possible in the future that something more fundamental in the page could be changed that would stop the code from working (this applies to any css or scripts that are written in individual projects too). We try to avoid renaming elements though so you should be ok.

I hope this helps
Fay

Please Log in or Create an account to join the conversation.

Last edit: by Fay.
  • Page:
  • 1
Moderators: ingdon
Time to create page: 0.044 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search