0

I'm trying to generate a printable version of kind of a contact form. By clicking the "#drucken"-button I'm trying to hide the content-wrapper and append the content of the form to the body with a new class "print". Everything seems to work on a Mac but doesn't on a Windows computer. Neither IE nor Firefox work on the Windows computer.

$('#drucken').click(function(){
    // druckfunktion
    // I'm getting all the variables and combine the in the dataString


        var dataString = 'patName=' + patName + '&patAdresse= ' + patAdresse + '&patTel=' + patTel + '&patTelG=' + patTelG + '&gebDatum=' + gebDatum + '&privat=' + privat + '&kkNummer=' + kkNummer + '&kkAdresse=' + kkAdresse + '&versicherung=' + versicherung + '&implantationsort=' + implantationsort + '&extraktion=' + extraktion + '&provisorium=' + provisorium + '&implantattypen=' + implantattypen + '&suprastruktur=' + suprastruktur + '&nachkontrollen=' + nachkontrollen + '&opt=' + opt + '&dvt=' + dvt + '&beilagen=' + beilagen + '&arzt=' + arzt + '&datum=' + datum;  
        //alert (dataString);return false;  
        $.ajax({  
            type: "POST",  
            url: "",  
            data: dataString,
            success: function(){
                $('body').addClass('print');
                $('#wrapper').fadeOut(200);
                $('body.print').append("<table><tr><td>Patienten Name:</td><td>" + patName + "</td></tr><tr><td>Patienten Adresse:</td><td>" + patAdresse + "</td></tr><tr><td>Tel. Nr.:</td><td>" + patTel + "</td></tr><tr><td>Tel. G.:</td><td>" + patTelG + "</td></tr><tr><td>Geb. Datum:</td><td>" + gebDatum + "</td></tr><tr><td>Privat/Krankenkasse:</td><td>" + privat + "</td></tr><tr><td>Krankenkassen Nummer:</td><td>" + kkNummer + "</td></tr><tr><td>Adresse Krankenkasse:</td><td>" + kkAdresse + "</td></tr><tr><td>Versicherung/IV/MV:</td><td>" + versicherung + "</td></tr><tr><td>Implantationsort:</td><td>" + implantationsort + "</td></tr><tr><td>Extraktion vor Implantation:</td><td>" + extraktion + "</td></tr><tr><td>Provisorium:</td><td>" + provisorium + "</td></tr><tr><td>Implantattyp:</td><td>" + implantattypen + "</td></tr><tr><td>Suprastruktur:</td><td>" + suprastruktur + "</td></tr><tr><td>Nachkontrollen:</td><td>" + nachkontrollen + "</td></tr><tr><td>R&ouml;ntgen:</td><td>" + opt + " " + dvt + "</td></tr><tr><td>Beilagen:</td><td>" + beilagen + "</td></tr><tr><td>&Uuml;berweisender Arzt:</td><td>" + arzt + "</td></tr><tr><td>Datum:</td><td>" + datum + "</td></tr><tr><td colspan=\'2\'><input type=\'button\' value=\'Formular ausdrucken\' onClick=\'javascript:window.print()\'></td></tr><tr><td colspan=\'2\'><input type=\'button\' value=\'zur&uuml;ck\' id=\'back\'></td></tr></table>")
                .hide()  
                .fadeIn(1500);
                $('#back').click(function(){
                    $('table').fadeOut(500);
                    $('body').removeClass('print');
                    $('#wrapper').fadeIn(1500);
                });
            }

        });  
        return false;  

});

Can anybody help me?

linzprod
  • 21
  • 3

1 Answers1

0

I'm using Opera but I don't see why it should work only with Mac? Here is my jsfiddle: http://jsfiddle.net/nfSRf/?

enter image description here

Micromega
  • 12,486
  • 7
  • 35
  • 72
  • Thanx for your Link I tried it in your jsfiddle and it worked on the mac but didn't on Windows. I don't get it. – linzprod Jun 12 '12 at 10:58
  • @linzprod: Then you must post your link?! My jsfiddle works with ie, opera, firefox in windows. What about your windows? Maybe it's hosed? – Micromega Jun 12 '12 at 11:07
  • here's the link. Thanx for checking: http://ilgenstein.ch/wp/oralchirurgie/zuweisung-von-zahnarzten-arzten/uberweisung-fur-implantate – linzprod Jun 12 '12 at 11:11
  • Like I said it's working but you have some errors before. Did you know about the prop method? http://stackoverflow.com/questions/426258/how-do-i-check-a-checkbox-with-jquery-or-javascript? Your code to validate the checkboxes results in a document error in Windows. – Micromega Jun 12 '12 at 11:27
  • No, I didn't know about the .prop() method. But I'll definitely check that out. Why is this thing not working with my windows machine? Got Vista on it. You? – linzprod Jun 12 '12 at 11:33
  • @linzprod: I don't know. It gives document error on my machine, too. But I use Opera Dragonfly to step through the code. I've Windows 7 64 Bit Ultimate. – Micromega Jun 12 '12 at 11:36
  • But how do I validate the checkboxes with the prop method? var opt= $('input#opt').prop('checked', true).val(); – linzprod Jun 12 '12 at 11:50
  • simply $(elem).prop("checked"). What is this val() in your script? – Micromega Jun 12 '12 at 11:57
  • The val() should be the value of the Checkbox that will be displayed in the printable form. – linzprod Jun 12 '12 at 12:09
  • A checkbox can be either true or false. The value is "checked" or undefined, depends how you ask. So, it doesn't make sense to me? What value do you want to display? If you want a value then you need an additional variable like an array and store your value in there. Is this a homework question? I'm sorry but this is getting funny. – Micromega Jun 12 '12 at 12:19
  • You can give the attribute value to a checkbox. value="whateveryoulike" I usually give it the same value as the label I use for the checkbox. Is that not common sense? – linzprod Jun 12 '12 at 12:24
  • @linzprod: Listen up, first off your question was about append. Then you asked me how do I validate the checkboxes. And third you tell me a checkbox has a value="whateveryoulike". When it's so simple why don't you ask another question? I've help you through the append bug. What has the third question to do with Macintosh or Vista anyway? – Micromega Jun 12 '12 at 12:31
  • @Chibox I'm sorry I definitely didn't want to annoy you. But you mentioned the prop method. Since i never heard of it I asked a question about it. And I'm sorry but I learned that checkboxes and radio button have the attribute value. This worked for me for years. And no, it's not a homework question. – linzprod Jun 12 '12 at 12:36
  • @linzprod: I see and I've answered it twice. IMO the property checked is only true or false. The value is a property from the input type. You need to query it in 2 steps. – Micromega Jun 12 '12 at 12:42