print instead of submit to email

dannyd 25 Apr, 2009
Is there a way I can have my submit button be a print button instead. I want people to fill out the form and click print to fax since there is social security numbers i can't email it.
nml375 25 Apr, 2009
Short answer; yes.

Long answer; You can alter the title of the submit-button to read whatever you like by changing it's 'value' property. To do the actual printing/faxing, you'll need some custom code - depending on the resources and API's available on the hosting server.

You'd also have to disable email delivery in the form setup.
dannyd 25 Apr, 2009
I disabled email delivery.

Can I change the submit button title through chronoforms admin ?

Is there code I can add to make it print instead of submit similar to the joomla article print with ONLY the form and not header and footer ?

Thanks so much!
nml375 25 Apr, 2009
Ohh, if you'd like to print it locally, I'd recommend using the onSubmit event to call a javascript function, that then opens a new window/tab and generates the content.
Unfortunately, I'm not a javascript wizard myself, but I believe there are numerous tutorials on this all around the web.

You could also alter the submit URL to read something like this:
http://www.cars4specialkids.com/index2.php?option=com_chronocontact&task=send&chronoformname=credit_application

Then, in the "on submit - after email" box, generate the content to be printed.

To change the text on the submit button, open your Form code, and locate the <input type="submit"> element, add/edit the 'value' property.
IE:
<input type="submit" value="Print page">


/Fredrik
dannyd 25 Apr, 2009
Thanks, I actually got it almost done by mixing ideas.

I added this javascript code to Form Javascript:

function printit(){
if (window.print) {
window.print();
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box
WebBrowser1.outerHTML = "";
}
}

And submit to this url:

href="#" onsubmit="JavaScript:printit();return false;"

Is there a way to ignore the header of the site when printing ?

My form is one this page:

http://www.cars4specialkids.com/component/chronocontact/?chronoformname=credit_application
nml375 25 Apr, 2009
None that I can think of. You can prevent them from being generated altoghether (along with the rest of your template) by accessing the form using index2.php rather than index.php (applies for all resources in your joomla installation).

I suppose with enough knowledge of your template, you might be able to hide all non-desired elements using javascript, but that would be template-dependant.

/Fredrik
GreyHead 26 Apr, 2009
Hi dannyd,

Adding &tmpl=component to the page url is the currently preferred way of showing a page without the template. (Index2.php works but is deprecated.)

Bob
This topic is locked and no more replies can be posted.