Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: exchange submit button with "print button"

exchange submit button with "print button" 8 months 1 week ago #101762

  • Fabian
  • Fabian's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 1
  • Karma: 1
Hi there!

I would like to exchange the submit button which shows up before finishing a survey with a "print button". As a result you should be able to print the survey results by using the default print function from ls. So when cklicking on "submit" (the button should be named "print") the default print window opens. Plus, you should not be transferred to the endpage, but remain on the same page.

If it's not possible to use the default print function without actually submitting the results I would be happy with printing the current browser page (by clicking on the "print button" the browser menu for printing the current page opens). However, as described you should not be transferred to the endpage, but remain on the same page.

So how can I change the function and name exclusively of the submit button (I still would need the next buttton)?

Tanks for any hints!!
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101784

Hi Fabian!

Is there a reason to why you want to print the survey BEFORE submitting it? One time I had a need for my participants to be able to print their survey answers and I used the built-in function of LimeSurvey that shows the participants answers after submitting them. Then you get a link on the end page to that printable page.

What I did was to inform the users (both in the welcome text and in a boiler plate question on the last page) that they had the possibility to print/save their answers after submitting.

Granted, the page with the participants answers isn't pretty, but it did the job for me.

The only time I had a need for the participants to see their answer before submitting was not for them to print, but rather to show them a calculation. The participants had input some data and were shown how much money they would pay given this data.

Then I used a boiler plate question and a little java script that used the answers of the previous questions to calculate and display a new page along with instructions that they could go back and change their answers if the calculations were incorrect. In this way you can get the summary to look the way you want. Adding a button that calls the browsers printmethod would be trivial.

Depending on what you want there I believe are a number of ways to achieve the intended effect without going into the innards of LimeSurvey.

Just my 2 cents.

/Max
Last Edit: 8 months 1 week ago by maxzomborszki. Reason: Language corrections
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101797

  • Fabian
  • Fabian's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 1
  • Karma: 1
Hi Max!

thanks for your reply! in this matter i'm not actually using ls as a survey tool. i rather want to show various data in tables with some extra text and maps depending on the inputs of the users. this all really works well. as a plus i want to offer a way to also print out the shown data. I think the printanswers method of ls won't be useful here so the browsers print method would be ok. so if its possible to use the submit button as a print button that would do. but it's important that this won't trigger the endpage, because it should be possible to print out various data sheets depending on the inputs..

i tried with this java script code:
<a href='#' onclick="javascript:window.print();returnfalse">print</a>
it works but i really have no clue how to add this as a codition to the submit button..

cheers,
Fabian
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101799

  • holch
  • holch's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 2567
  • Thank you received: 291
  • Karma: 106
You probably can't subsitute the submit button by a print button. But what you might be able to do is to hide the submit button via css (or javascript) and instead add a button that triggers the browser print function.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101800

  • Fabian
  • Fabian's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 1
  • Karma: 1
thanks holch. i use the welcome page for instructions and then only one page for the data. so i could hide the navigator-buttons on odd pages and insert a print button or link. that would work as long as i still have the prev-button. so is there a way to only hide the next/submit-button but keep the prev-button? to me it seems that the navigator-buttons are like one "unit"..
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101802

  • holch
  • holch's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 2567
  • Thank you received: 291
  • Karma: 106
They might be inserted as one unit into the template, but I think that they are somehow different later on.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101807

  • Fabian
  • Fabian's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 1
  • Karma: 1
I found 2 spots but hiding one or another applies to both the prev- and the next/submit-button..

.submit-buttons {
text-align: center;
width: 40%;
}

input.submit {
padding: 0 15px;
margin: 5px;
}

how might the differenciation between the 2 buttons look like? i didn't find any more relevant spots in my css..
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101810

  • Fabian
  • Fabian's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 1
  • Karma: 1
i found a workaround which works fine for my purposes..

i hide the page odd submit-buttons and exchange the clear all button with the restart link, which then works as a previous button (since i only use one page). then i insert a print link where you usually can find the save all button.

the only thing left to do is to rename the restart link. how can i achieve this?
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101815

  • Fabian
  • Fabian's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 1
  • Karma: 1
apparently in replacements.php
The administrator has disabled public write access.

exchange submit button with "print button" 8 months 1 week ago #101828

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
I wouldn't hack the core code.

You can use JavaScript to detect the submit button and insert your replacement (print?) button. Something like:

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() { 
 
		// Only if the Submit button exists...
		if($('#movesubmitbtn').length > 0) {
 
			// Hide the submit button
			$('#movesubmitbtn').hide();
 
			// Insert the new button
			var newButton = '<button type="button" value="Print" onclick="javascript:window.print();">Print</button>';
			$('#movesubmitbtn').after(newButton);
		}
    });
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.152 seconds
Donation Image