exchange submit button with "print button"

More
3 years 6 months ago #101762 by Fabian
Fabian created the topic: exchange submit button with "print button"
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!!

Please Log in to join the conversation.

More
3 years 6 months ago - 3 years 6 months ago #101784 by maxzomborszki
maxzomborszki replied the topic: exchange submit button with "print button"
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: 3 years 6 months ago by maxzomborszki. Reason: Language corrections

Please Log in to join the conversation.

More
3 years 6 months ago #101797 by Fabian
Fabian replied the topic: exchange submit button with "print button"
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

Please Log in to join the conversation.

More
3 years 6 months ago #101799 by holch
holch replied the topic: exchange submit button with "print button"
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.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
3 years 6 months ago #101800 by Fabian
Fabian replied the topic: exchange submit button with "print button"
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"..

Please Log in to join the conversation.

More
3 years 6 months ago #101802 by holch
holch replied the topic: exchange submit button with "print button"
They might be inserted as one unit into the template, but I think that they are somehow different later on.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
3 years 6 months ago #101807 by Fabian
Fabian replied the topic: exchange submit button with "print button"
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..

Please Log in to join the conversation.

More
3 years 6 months ago #101810 by Fabian
Fabian replied the topic: exchange submit button with "print button"
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?

Please Log in to join the conversation.

More
3 years 6 months ago #101815 by Fabian
Fabian replied the topic: exchange submit button with "print button"
apparently in replacements.php

Please Log in to join the conversation.

More
3 years 6 months ago #101828 by tpartner
tpartner replied the topic: exchange submit button with "print button"
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.

Please Log in to join the conversation.

More
3 years 6 months ago #101840 by Fabian
Fabian replied the topic: exchange submit button with "print button"
it's not very elegant but only for a temporary use. thanks for the professional solution anyway!

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now