This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 4

Removing Carriage Returns/Spacing from Text/Paragraph Fields??


  1. agdm619
    Member

    We have users using a lot of returns or enters when filling out our forms. Is there a way to use a Java Script to remove the carriage returns or enters when users utilize them?

    The main problem we are seeing is, some people are copy and pasting information that has built in formatting into these fields that includes tons of spacing between lines of information. See example - https://www.genprod.com/onlineforms/downloads/returns.jpg

    This is causing in most cases our emails to be multiple pages long a causing pages and pages of PDF's that could be condensed to one page easily by removing the returns in the text fields!

    I have found some information online about using Java Scripts to remove carriage returns. I've tried some of these options, but I guess my experience is not up to the level needed to get it to work.

    HELP!
    Aaron

    Posted 9 years ago #
  2. yuniar

    Try this, create a file with the name custom.js (or any name actually), put the file under your machform folder and paste this code into the file:

    $(function(){
    	$('textarea.textarea').bind('keyup mouseout mousemove change', function() {
    		$(this).val($(this).val().replace("\n\n", ''));
    	});
    });

    Then go to your form properties tab, click "show more options" and turn on "Load Custom Javascript File"
    You'll be prompted to enter the URL of your custom javascript file. Put the URL of the above file there.

    In this example, the URL should be something like:

    https://www.genprod.com/onlineforms/custom.js

    The code above should automatically remove excess carriage returns.


    MachForm Founder

    Posted 9 years ago #
  3. agdm619
    Member

    This seems to work great other than if the data is pasted from another source (i.e. excel). Then it doesn't seem to remove the extra lines. anyway to force this?

    Posted 9 years ago #

RSS feed for this topic

Reply