• Resolved fibbu

    (@fibbu)


    Hello;
    I am writing an equation. For example I created a textarea box. The user enters text. I also convert these texts to uppercase or lowercase.

    But the problem is that the text is long text and there are line spaces between paragraphs. When I calculate the result, it does not take into account the line spacing.

    For example :
    Ahmet went home and took off his top. He then ate.

    He had to turn back after he forgot his car key.

    Conclusion :

    AHMET WENT HOME AND TOOK OFF HIS TOP. HE THEN ATE. HE HAD TO TURN BACK AFTER HE FORGOT HIS CAR KEY.

    it writes like this and ignores line spacing. Can you have a suggestion?

    (function() {
      var kriter1 = '' ;
    
      if (fieldname27 === 'A') {
        kriter1 = fieldname26.replace(/([A-Z][^\n]*)\n/g, '$1\n\n').toUpperCase();
      }
      if (fieldname27 === 'B') {
        kriter1 = fieldname26.replace(/([A-Z][^\n]*)\n/g, '$1\n\n').toLowerCase();
      }
      jQuery('#calculation-kriter1').html(kriter1);
      jQuery('.kriter1-sonuc').html(kriter1);
    
      return [kriter1];
    })();
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @fibbu

    Note you are taking data from a textarea and displaying it in an “HTML Content” field. In textareas, the changes of lines are represented by \n, but in HTML the changes of lines are represented by
    tags. Also, you must use the |r modifier with the textarea field’s name in the equation. The |r modifier allows you to access the raw field’s value instead of the preprocessed by the plugin:

    (function() {
      var v = fieldname26|r, kriter1 = '', kriter1_br;
    
      if (fieldname27 === 'A') kriter1 = v.toUpperCase();
      if (fieldname27 === 'B') kriter1 = v.toLowerCase();
      
      kriter1_br = kriter1.replace(/[\r\n]/g, '<br>');
    
      jQuery('#calculation-kriter1').html(kriter1_br);
      jQuery('.kriter1-sonuc').html(kriter1_br);
    
      return kriter1;
    })();

    Best regards.

    Thread Starter fibbu

    (@fibbu)

    Thank you, it worked.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Line Spacing (Textarea)’ is closed to new replies.