Skip to main content
Known Participant
August 9, 2010
Question

Rich text validation

  • August 9, 2010
  • 2 replies
  • 1093 views

Hi there,

Is there any way to validate the input in the rich text area before submission? Let's say I have a form with rich text enabled and user just copy/pastes something off net. It looks all fine, but at the time of submission it doesn't validate and gives coldfusion error report. However, that is already too late as half of the form has been already submitted and some tables updated/records created which makes a big mess. So is there any way to validate html code inside the text area?

cheers,

Simon

    This topic has been closed for replies.

    2 replies

    Inspiring
    August 9, 2010

    Once you have figured out the code, you'll have to figure out a way to make it useable.  For example, if someone copies half a paragraph from somewhere, are you really going to refuse the submission?

    Simon.DauAuthor
    Known Participant
    August 9, 2010

    Dan, this rich text form is for administrators use only and is a part of the code to create a new personalised profile. Therefore rich form is very helpful, but has to be done correctly in order to display page without any errors. Besides it doesn't let me run through the submission code as coldfusion hangs on some error related to this badly formatted text.

    Well, i'll try to use AJAX to perform isXML. Hopefully that will sort it out for me.

    Inspiring
    August 9, 2010
    Is there any way to validate the input in the rich text area before submission?

    What rule(s) are you trying to enforce with your validation?

    gives coldfusion error report

    What is the error message?

    but at the time of submission it doesn't validate and gives coldfusion error report. However, that is already too late as half of the form has been already submitted and some tables updated/records created which makes a big mess.

    You should validate the input on the server-side before doing any database changes.

    It will be easier to help you if you can provide your code.

    Simon.DauAuthor
    Known Participant
    August 9, 2010

    Hi Bob,

    When copied from the net text sometimes has unclosed tags such as </div> or </span> etc. If left it causes the error. Therefore I wanted to know whether there is some function or any other method to check html code inside rich text area on submission and if not validated display error message.

    Inspiring
    August 9, 2010

    If you are requiring the user to input valid xhtml you might use the IsXml function to determine if the input is XML.