/    Sign up×
Community /Pin to ProfileBookmark

Printing form fields

Ok, I found the following code posted on here and ahve modified it to my needs. The only problem is I have checkboxes on my form and only want to print the value of the “checked” checkbox. Also, the “submit” and “print” button values keep printing and I would like them not to print.

Thanks for any help!

[SIZE=1]<script type=”text/javascript”>
function print_text(some_text){
if(window.createPopup){
var oPopup = window.createPopup();
the_script = oPopup.document.createElement(‘script’);
the_script.src=”popup.js”;
oPopup.document.body.innerHTML=some_text;
oPopup.document.body.appendChild(the_script);
oPopup.show(100, 100, 0, 0);
}else{
the_script = document.createElement(‘script’);
the_script.src=”popup.js”;
test = window.open();
test.document.write(some_text);
test.document.body.appendChild(the_script);
setTimeout(‘test.close()’,200);
}
}

function print_form(form_element){
text = “”;
for(x=0; x<form_element.elements.length; x++){
text += form_element.elements[x].value + “<br><br>n”;
}
print_text(text);
}
</script>[/SIZE]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorMay 06.2004 — maybe the attached example will help you

[upl-file uuid=3744fb50-3d1b-4ce9-9a75-f687907f0d22 size=559B]ex.zip[/upl-file]
Copy linkTweet thisAlerts:
@mikeyzcauthorMay 07.2004 — not exactly. Say on my form I have 5 checkboxes. Right now they all print, but I only want the "checked" checkboxes to print. Also, How would I go about printing the text field name before the value, so on the print out I know what it's for?
Copy linkTweet thisAlerts:
@mikeyzcauthorMay 10.2004 — *bump* anybody?
×

Success!

Help @mikeyzc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...