- Posts: 102
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Changing soft warning buttons text and order
3 months 2 days ago #239052
by boshra.m
Changing soft warning buttons text and order was created by boshra.m
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud Version 5.4.12
Own server or LimeSurvey hosting: Own server
Survey theme/template: Fruity
==================
Hello,
I was wondering if it was possible to change 1) the text of the soft warning buttons 2) The order of the buttons (ie. staying on the page to answer the questions as the left button and moving on to the next page as the right button) and 3) The colour of the text of the buttons to be each different colours?
I was able to figure out how to change the text of the left button but not the right using this script in my question source. Just not sure how to differentiate the left and right buttons.
<script type="text/javascript">
$(document).on('ready pjax:scriptcomplete',function(){
$('#mandatory-soft-alert-box-modal').text('XX');
});
</script><script type="text/javascript">
$(document).on('ready pjax:scriptcomplete',function(){
$('#.modal-footer .btn+.btn').text('YY);
});
</script>
Thank you!
Your LimeSurvey version: LimeSurvey Cloud Version 5.4.12
Own server or LimeSurvey hosting: Own server
Survey theme/template: Fruity
==================
Hello,
I was wondering if it was possible to change 1) the text of the soft warning buttons 2) The order of the buttons (ie. staying on the page to answer the questions as the left button and moving on to the next page as the right button) and 3) The colour of the text of the buttons to be each different colours?
I was able to figure out how to change the text of the left button but not the right using this script in my question source. Just not sure how to differentiate the left and right buttons.
<script type="text/javascript">
$(document).on('ready pjax:scriptcomplete',function(){
$('#mandatory-soft-alert-box-modal').text('XX');
});
</script><script type="text/javascript">
$(document).on('ready pjax:scriptcomplete',function(){
$('#.modal-footer .btn+.btn').text('YY);
});
</script>
Thank you!
Please Log in to join the conversation.
3 months 2 days ago #239073
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Changing soft warning buttons text and order
1) & 2) Place this script in the source of a question:
3) After inserting that script, place something like this CSS in the source of a question:
Sample survey attached:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify some elements var modalSubmitBtn = $('#mandatory-soft-alert-box-modal'); var mandatoryModal = $(modalSubmitBtn).closest('.modal'); var modalCancelBtn = $('a[data-bs-dismiss="modal"]', mandatoryModal); var modalBody = $('.modal-body', mandatoryModal); // Add some classnames so we can style the modal mandatoryModal.addClass('soft-mandatory-modal'); modalSubmitBtn.addClass('soft-mandatory-modal-submit'); modalCancelBtn.addClass('soft-mandatory-modal-cancel'); // Move the buttons modalSubmitBtn.before(modalCancelBtn); // Submit button text modalSubmitBtn.text('New submit text'); // Cancel button text modalCancelBtn.text('New cancel text'); }); </script>
3) After inserting that script, place something like this CSS in the source of a question:
Code:
<style type="text/css" data-author="Tony Partner"> .soft-mandatory-modal-submit { background-color: #FF33FF } .soft-mandatory-modal-cancel { background-color: #00CCFF; } </style>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: boshra.m
Please Log in to join the conversation.
3 months 1 day ago #239088
by boshra.m
Replied by boshra.m on topic Changing soft warning buttons text and order
Hello,
Thank you so much for this, it worked! However, I am unable to change the colour of the buttons using your code in the question source or in the css. When I imported the survey you linked interestingly enough the colours didn't appear. I also tried testing it out by using the web developer and it crosses it out.
Thank you again
Thank you so much for this, it worked! However, I am unable to change the colour of the buttons using your code in the question source or in the css. When I imported the survey you linked interestingly enough the colours didn't appear. I also tried testing it out by using the web developer and it crosses it out.
Thank you again
Please Log in to join the conversation.
3 months 1 day ago #239093
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Changing soft warning buttons text and order
I tested with the vanilla theme.
You will need to use the browser developer tools to find which style rules are taking precedence and increase the specificity of the rules in the question source to override those.
You will need to use the browser developer tools to find which style rules are taking precedence and increase the specificity of the rules in the question source to override those.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: boshra.m
Please Log in to join the conversation.