This is the place for questions about learning design and pedagogy; how to use different page types for different purposes.

Restart button in the Gap Fill page type

  • annem
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 6 months ago - 8 years 6 months ago #4938 by annem
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
Last edit: 8 years 6 months ago by annem.

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

More
8 years 6 months ago #4948 by Fay
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):
Code:
$("#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.

  • annem
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 6 months ago #4950 by annem
Replied by annem on topic Restart button in the Gap Fill page type
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.

More
8 years 6 months ago - 8 years 6 months ago #4952 by Fay
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
Last edit: 8 years 6 months ago by Fay.

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

Moderators: ingdon
Time to create page: 0.126 seconds
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo