What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Is there any input that will $_POST the RTF correctly?

    Asked by rpjostform1 on July 03, 2017 at 02:32 AM

    I have tried all of the JotForm inputs and widgets that allow for a user to enter RTF content.  However, the data sent via $_POST removes ALL formatting.  Is there any way to retain any HTML formatting sent via $_POST?

    1.  I know about PHP's nl2br() to add line breaks.  This is correctly adding <br> to the data.  But that seems to be the only formatting.

    2.  I cannot use the CK Editor Widget because I am also using the Preview Before Submit Widget.  Unfortunately, the PREVIEW widget does not 'see' the CK Editor's content.

     

    Thanks.

  • Profile Image
    JotForm Support

    Answered by Nik_C on July 03, 2017 at 04:16 AM

    1. Did you try using the Long text entry and switching to Rich text:

    The data submitted retained the formatting I did:

    Or the data is not preserved later on?

    2. That is true, a widget will not be shown in Preview before submit page.

    We'll wait for your response.

    Thank you!

  • Profile Image

    Answered by rpjostform1 on July 03, 2017 at 07:07 PM

    Here's an example of what I mean...

    Using the Long Text input with the Rich Text selection...

     *Code below has been edited to allow you to see the tags (= I added white space)

    The original data entered was this:

    < strong > teaching< /strong > and < strong >research< /strong >

    Unfortunately, this was received as this:

    < span style="box-sizing: border-box;" >teaching< /span > and < span style="box-sizing: border-box;" >research< /span >

     

    Please test yourself to confirm.  I don't have any PHP coding that would remove HTML tags.  I'm using the same $_POST input code for all data.  Obviously, a plain ol' strong tag should make it through - but I guess not.

     

    P.S.: I must have the ability for my users to COPY/PASTE their code into my form... which is where the code above originated - from a website.

     

    Thanks.

  • Profile Image
    JotForm Support

    Answered by Chriistian on July 03, 2017 at 09:05 PM

    I tried to test the Long Text Entry field with Rich text selection on my end. The data I entered was:

    <strong>Test</strong>

     

     

    And here's the result:

     

    May we know the whole your PHP code so that we can further check it?

    We'll wait for your response.
    Regards.

     

  • Profile Image

    Answered by rpjostform1 on July 04, 2017 at 01:15 AM

    How to reproduce this situation...

     

    1.  Use this form:

    https://form.jotform.us/71831084454153

     

    2.  for the BIO INFO entry data, go here:

    https://www.jhu.edu/about/

    *Why am I using this page?  This would be a typical "type" of webpage that one of my clients may use as a COPY/PASTE situation for their BIO info.  I researched the HTML in this page/section and it's vanilla.  I completely understand if an external CSS parameter would cause a style to occur.  That's not the case in this section.  All (= most) styles in this section are inline.

     

    3.  COPY/PASTE the middle main content of this ABOUT page:

    from... “What are we aiming...

    to... (PDF)

    4.  Enter/PASTE this section into the BIO INFO input

    5.  Complete the form and submit.

    6.  View the $_POST output data and you'll see that the < strong > tags:

    < strong > teaching< /strong > and < strong >research< /strong >

    are gone.  AND... if you "INSPECT" (using your browser's INSPECT feature in the page https://www.jotform.com/show-post-data/ ") the originally "< strong >" tagged words, you'll see that they are now tagged with:

    < span style="box-sizing: border-box;" >teaching< /span > and < span style="box-sizing: border-box;" >research< /span >

    It does seems as if other HTML tags are passing correctly.  Maybe this is specific to the "< strong >" tag. ??  Could there be other HTML tags that are not passing?  I haven't done extensive testing yet.

     

    Thanks for your help.

     

     

     

     

  • Profile Image
    JotForm Support

    Answered by Chriistian on July 04, 2017 at 03:16 AM

    Thanks for proving more info.

    I have tried to follow the steps you have provided to replicate the issue and I noticed that even before submitting the form, the HTML formatting <strong> tag is not being copied properly on the Long text entry with rich text when copying the text from the site (https://www.jhu.edu/about/) to your form. That's why after clicking the submit button, that will be the result also.

     

    However, when I tried it with <b> tag, here's the result:

     

    Result:

     

    Could you please try it also on your end and see if this helps?

    If the issue still persists, please let us know.
    Regards.

  • Profile Image

    Answered by rpjostform1 on July 05, 2017 at 03:11 PM

    Yep.  I did miss this.  So this issue is occurring at the point of the PASTE into the RTF Editor, correct?

    Is this an issue with the RTF editor or ??

    Any suggestions you have for a fix, a different method for the COPY/PASTE, or anything as a workaround are welcome.

    FYI:  I cannot use the CK Editor Widget as I am using the Preview Before Submit Widget which does not 'see' any input data from this widget (causing validation issues).

     

    Thanks.

  • Profile Image
    JotForm Support

    Answered by Kevin_G on July 05, 2017 at 05:08 PM

    May we get a screenshot about how the information is posting on your end? 

    This is how I can see it on a cloned form of yours: 

    This guide will help you uploading the image with your next reply: How-to-Post-Screenshots-to-Our-Support-Forum

    Regarding the conflict between the CKEditor and the Preview Before Submit widgets, I could replicate it on my end, this seems an issue, but we will assist you on a different thread. 

    https://www.jotform.com/answers/1191920 

     

  • Profile Image
    JotForm Support

    Answered by Chriistian on July 06, 2017 at 05:30 AM

    It seems there is no issue with the Long Entry Text field (with Rich text selection) in the form since HTML formatting is being retained when submitting the form as we test it on our end. The only way to keep it working is to not Copy a text and paste it into the RTF editor, instead, do the editing of the texts directly to the RTF editor.

    Regards.

  • Profile Image

    Answered by rpjostform1 on July 06, 2017 at 02:57 PM

    Yep.  Thats what I thought your response was going to be.  The "COPY/PASTE" functionality is simply not going to happen 100% of the time.

    Or, at the very least... the user can choose to COPY/PASTE their content into the RTF editor ... but then, they need to carefully review the content to find the sections that have not been properly formatted.  .. and that's it, correct?

  • Profile Image
    JotForm Support

    Answered by Kevin_G on July 06, 2017 at 03:33 PM

    Yes, that is correct, it's recommended to format the text directly using the tool. I have further tested and found the reason why this happens. 

    The rich text editor will recognize the format if it has been applied using HTML tags, an example would be: 

    <p>

    <i>

    <b>

    <u>

    Text 2

    </u>

    </b>

    </i>

    </p>

    But, if the style has been applied using CSS codes (which seems to be the case with the text you are trying to copy and paste) then it will not be saved when the form is submitted, example, the text is displayed only using the HTML, but styled using CSS: 

    <p>Text 1</p>

    You can easily see the behavior with the following example: https://shots.jotform.com/kevin/Content/Samples/1189768/ 

    "Text 1" has been formatted using CSS while "Text 2" has been formatted using HTML tags, if you copy the first text it will not show the format on the POST data, but the second text will do. 

    In other words all the text would need to be formatted using HTML tags, which will not be always the case. 

    You could add the recommendation on your form, to suggest your users to format the text using the editor will help you to always keep the text as desired. 

    Hope this information helps. 

     

  • Profile Image

    Answered by rpjostform1 on July 06, 2017 at 03:58 PM

    THANK YOU!!