Coder Social home page Coder Social logo

Comments (8)

ssuess avatar ssuess commented on June 9, 2024

Well, I have a workaround, but it isn't pretty. By using jquery to force set the text (not val) of the textarea after entering text but before printing, the print code will now pick it up.

from jquery.print.

CitizenOfRome avatar CitizenOfRome commented on June 9, 2024

Thanks, fixed!
manuallyCopyFormValues basically does the same thing, I had somehow missed adding support for textareas when I wrote it earlier

Please take a look and let me know if there are any issues still

from jquery.print.

ssuess avatar ssuess commented on June 9, 2024

Thanks!

from jquery.print.

ssuess avatar ssuess commented on June 9, 2024

actually, the new code doesn't work for me, I reverted back to my fix, which was essentially a separate function on the page that sets the values onblur:

jQuery(function() { jQuery("textarea.fromto").blur(function () { if(jQuery(this).val()!= "" ) { jQuery("textarea.fromto").text(jQuery(this).val()); } } });

from jquery.print.

CitizenOfRome avatar CitizenOfRome commented on June 9, 2024

Hmm, that's odd, because that is essentially what we're doing here, only right before we insert the selected content into an iframe for printing rather than on-blur:

copy.find("textarea").each(function () {
   // Fix for https://github.com/DoersGuild/jQuery.print/issues/18#issuecomment-96451589
  var $field = $(this);
  $field.text($field.val());
});

from jquery.print.

ssuess avatar ssuess commented on June 9, 2024

I don't understand either, it looks very similar. Let me go back through the code and see if anything sticks out...

from jquery.print.

ssuess avatar ssuess commented on June 9, 2024

I don't understand why you closed the other bug in relation to this one, they seem quite separate issues to me.

from jquery.print.

KevinNBaer avatar KevinNBaer commented on June 9, 2024

This added to the jQuery.print.js object will get the textareas cloned correctly.

(function (original) {
  jQuery.fn.clone = function () {
    var result = original.apply (this, arguments),
        my_textareas = this.find('textarea'),
        result_textareas = result.find('textarea'),
        my_selects = this.find('select'),
        result_selects = result.find('select');

    for (var i = 0, l = my_textareas.length; i < l; ++i)
      $(result_textareas[i]).val ($(my_textareas[i]).val());

    for (var i = 0, l = my_selects.length; i < l; ++i)
      $(result_selects[i]).val ($(my_selects[i]).val());

    return result;
  };
}) (jQuery.fn.clone);

from jquery.print.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.