Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Change label for default "Return to Survey" button in upload file modal

  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months ago #199035 by ritapas
Hello,
a customer with Limesurvey 2.6.6LTS asked me to change the default label of many survey buttons in a custom theme. In brief, they want to show the survey as an "application form".
I cannot access to the filesystem so I cannot change the translation files.

XSS filter is on.

I've managed to change the label for the Back, Exit and clear, Captcha text in the template.js
Code:
$(document).ready(function(){
    var previousText = "Back";
    $('#moveprevbtn .ui-button-text').text(previousText);
    var clearAllText = "Exit and clear the application";   
    $('#clearall .ui-button-text').text(clearAllText);
    var captchaText = "Please confirm access to the application by answering the security question below and click continue.";
    $('#welcome p .captcha').text(captchaText);
    var loadAllText = "Load unfinished application";
    $('#loadallbtn .ui-button-text').text(loadAllText);
 
    // THIS WON'T WORK //
    var returnToSurvey = "Back to the application"
    $('.dialog-upload .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button-text').text(returnToSurvey);
});
 

However, I cannot find a way to change the "Return to survey" button in the "upload file" modal form, because at "document.ready" it is not still present.

The modal form is as in the attached picture.
[img



Any hints?
Regards
Rita
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months ago #199074 by ritapas
P.S.:
if after having opened the upload modal form I type the following code in the JavaScript Console, the button label changes as expected.
Code:
var returnToSurvey = "Back to the application";
    $('.dialog-upload .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button-text').text(returnToSurvey);
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #199098 by DenisChenu
Old version here, the jqueryui, maybe try api.jqueryui.com/dialog/#event-open ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: ritapas
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months ago - 3 years 11 months ago #199114 by ritapas
Yes Denis,
this works, thank you so much!!!

For the others like me who don't know much about JQuery this is the way I did:


1. The dialog is already initialised with the open callback function;

2. This code has been added outside the document.ready()
Code:
$(document).on("dialogopen", ".dialog-upload", function(event, ui) {
      var returnToSurvey = "Back to the application";
      $('.dialog-upload .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button-text').text(returnToSurvey);
});


I hope this can help some other newbies like me.

Thank you again.
Rita
Last edit: 3 years 11 months ago by ritapas.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose