Welcome to the LimeSurvey Community Forum

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

move next button

  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #152848 by marcomarenco
move next button was created by marcomarenco
hi,
i'm trying to move the "nextbutton" near the inputbox (in this case i use shortext) on the right.

i would change form this:


to this:


i'm using the template editor, i've changed question.pstpl in this way:

<div class="col-sm-12 answer" style="border: 5px solid red;">
{ANSWER}
999<div class="col-xs-6 save-all text-right">
{MOVENEXTBUTTON}
</div>999
</div>
but i don't see nothing. it seems that is not possibile to insert the buttons in question.pstpl page


i've done a test changing welcome.pstpl page:
<!-- Survey Welcome -->
<div class="row survey-welcome">
<div class="col-sm-12 ">
<p class='surveywelcome'>
{WELCOME}{MOVEPREVBUTTON}{MOVENEXTBUTTON}
</p>
</div>
</div>

and i can see the button:


do you have any idea?

thanks in advance.

Marco
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #152997 by tpartner
Replied by tpartner on topic move next button
Do you want this for every page or only specific questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #152999 by marcomarenco
Replied by marcomarenco on topic move next button
Hi Tony,
i need only for shor text question. For now i've solved in this way:
in file: "limesurvey\application\views\survey\questions\shortfreetext\text\item.php"

i've added the button:
<input
class="form-control text <?php echo $kpclass;?>"
type="text"
size="<?php echo $tiwidth; ?>"
name="<?php echo $name; ?>"
id="answer<?php echo $name;?>"
value="<?php echo $dispVal; ?>"
<?php echo $maxlength; ?>
onkeyup="<?php echo $checkconditionFunction; ?>"
/>
<!-- MODIFICA TEACUP -->
<button type="submit" id="movenextbtn" value="movenext" name="movenext" accesskey="n" class="submit button btn btn-lg btn-primary">Avanti</button>
<!-- FINE MODIFICA TEACUP -->


and i've deleted the reference for the navigato in "navigator.pstpl":
<div class="col-xs-12">
</div>

then, for the other kind of question like array, multiplechoiche, i've added in the field "tips for the question or explanation note" ( i don't know the name in english, i'm using the italian version, it's the text area after question field ):
<button type="submit" id="movenextbtn" value="movenext" name="movenext" accesskey="n" class="submit button btn btn-lg btn-primary">Avanti</button>

i think that it's not the best solution :ohmy:

bye
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153001 by tpartner
Replied by tpartner on topic move next button
I would definitely not hack the core files to accomplish this - that will leave you exposed to over-writing when updating.

If only required for specific short-text questions, you can move the button with JavaScript. Set up your survey to use JavaScript and place the following script in the source of the question:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function(){  
    $('#question{QID} .form-group').append($('#movenextbtn, #movesubmitbtn'));  
    $('#movenextbtn, #movesubmitbtn').addClass('inserted-button');
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153015 by marcomarenco
Replied by marcomarenco on topic move next button
Ho Tony,
thanks for your reply, and it's a group of questions, i could put javascript for every questions? and leave blank navigator.pstpl?

thanks,
Marco
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153033 by tpartner
Replied by tpartner on topic move next button
You could put it in every question or, if your template shows the group description, place it there.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153039 by marcomarenco
Replied by marcomarenco on topic move next button
Hi Tony,
i've tried with your code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#question{QID}.form-group').append($('#movenextbtn, #movesubmitbtn'));
$('#movenextbtn, #movesubmitbtn').addClass('inserted-button');
});
</script>

{QID}= I've to write the code manually? or i can use this like a system variable for limesurvey e.g. like {TOKEN}?

I've tried to either in group description or in the question.
bye:)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153095 by tpartner
Replied by tpartner on topic move next button
You have removed a necessary space in the code. Be careful to always copy supplied scripts exactly.

Here is a working sample survey.

File Attachment:

File Name: limesurvey...4844.lss
File Size:12 KB

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: Ben_V
The topic has been locked.
  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago - 6 years 10 months ago #153103 by marcomarenco
Replied by marcomarenco on topic move next button
Hi Tony,
sorry i'm able to answer you just now.
i've solved in this way:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('.form-group').append($('<br><br>'));
$('.form-group').append($('#movenextbtn, #movesubmitbtn'));
$('#movenextbtn, #movesubmitbtn').addClass('inserted-button');
$( ".form-group" ).append( "<p>Per proseguire premi il tasto <strong>INVIO</strong> o clicca sul tasto <strong>AVANTI</strong></p>" );
});
</script>
i've checked the code and it seems that is enough to use 'form-group', after i've put "hidden" the div in navigator.pstpl, and everything seems ok.
before this, i've tried using both {QID} and {SGQ} (using your code, anche checking the source) but nothing happens

tomorrow i'll try your survey:)

thanks for your help and your very quickly replies :)

bye,
Marco
Last edit: 6 years 10 months ago by marcomarenco.
The topic has been locked.
  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153118 by marcomarenco
Replied by marcomarenco on topic move next button
Hi Tony,
i've test your code, thanks :) i try to put javasript code in group description, but it doesn't get the QID.
i've tried with this:
Survey ID: {SID} Group ID: {GID} Question ID: {QID}
in group description, i take only the first two, in question source, i take all the three.

thanks,

Bye
Marco
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153194 by tpartner
Replied by tpartner on topic move next button
Oops, sorry, I misspoke - {QID} is only available in the question text.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • marcomarenco
  • marcomarenco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153203 by marcomarenco
Replied by marcomarenco on topic move next button
Cheers:)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose