• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Server Side Form Validation Page Shows HTML

New Here ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

I saw a post about this a few years ago, but never an answer.

We have some very old forms that use the hidden field type of server side validation to check required fields (_required).  The same forms on ColdFusion 10 return a correctly formatted validation error page.  The form under CF11 returns a page that shows the html tags.

The form contains hidden fields like this: <input type="hidden" name="From_required" value="Name of person submitting request is required.">

When a form is submitted with an empty field the page displayed looks like this:

Form entries are incomplete or invalid.

   <ul><li>Name of person submitting request is required. </li></ul> Go <a href="javascript:history.back()">back</a> and correct the problem.

I know using this type of validation isn't good, but we need to get them over to CF11 as is for now.  I tried changing the form to a cfform, but got the same results.  I also changed the _required to _cfformrequired, but no difference.

Any ideas what may be causing this?  Any suggestions appreciated.  Thanks.

Views

450

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 15, 2017 May 15, 2017

Copy link to clipboard

Copied

It is a bug. Please report it.

In the meantime you could quickly, and simply, set up a workaround. Remove the _required, then use validation by means of jQuery.

You may use this jQuery validation example​:

<form method="post" name="userForm">

  First name:<br>

  <input type="text" name="firstname">

  <br>

  Last name:<br>

  <input type="text" name="lastname" >

  <br>

E-mail:<br>

  <input type="text" name="email">

  <br><br>

  <input name="sbmt" type="submit" value="Submit">

</form>

<script src="https://cdn.jsdelivr.net/jquery/1.12.4/jquery.min.js"></script>

<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>        

<script type="text/javascript" >

// Wait for the DOM to be ready

$(function() {

  // Initialize form validation on the registration form.

  // It has the name attribute "registration"

  $("form[name='userForm']").validate({

    // Specify validation rules

    rules: {

      // The key name on the left side is the name attribute

      // of an input field. Validation rules are defined

      // on the right side

      firstname: "required",

      lastname: "required",

      email: {

        required: true,

        // Specify that email should be validated

        // by the built-in "email" rule

        email: true

      }

    },

    // Specify validation error messages

    messages: {

      firstname: "Please enter your firstname",

      lastname: "Please enter your lastname",

      email: "Please enter a valid email address"

    },

    // Make sure the form is submitted to the destination defined

    // in the "action" attribute of the form when valid

    submitHandler: function(form) {

      form.submit();

    }

  });

});

</script>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2017 May 16, 2017

Copy link to clipboard

Copied

LATEST

You're using <cfform tags?

Chuck

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation