Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:07:43+00:00 2026-06-01T20:07:43+00:00

So I understand that CakePHP automatically loads the error message into the view if

  • 0

So I understand that CakePHP automatically loads the error message into the view if you validate it against the Model’s validators. I am trying to setup a date dropbox validation, and I want to control where the error message shows up.

Before submitting to validate form:

<div class="input text required">
<label for="UserEmail">Email</label>
<input name="data[User][email]" maxlength="50" type="text" id="UserEmail">
</div>

After validating, error shows up here:

<div class="input text required error">
<label for="UserEmail">Email</label>
<input name="data[User][email]" maxlength="50" type="text" value="" id="UserEmail" class="form-error">
<div class="error-message">An email is required</div>
</div>

Is it possible to control it where I can have it show up here?

<div class="input text required error">
<div class="error-message">An email is required</div>
<label for="UserEmail">Email</label>
<input name="data[User][email]" maxlength="50" type="text" value="" id="UserEmail" class="form-error">
</div>

Or here:

<div class="error-message">An email is required</div>
<div class="input text required error">
<label for="UserEmail">Email</label>
<input name="data[User][email]" maxlength="50" type="text" value="" id="UserEmail" class="form-error">
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:07:44+00:00Added an answer on June 1, 2026 at 8:07 pm

    In the VIEW:

    1) Disable automatic error display:

    echo $this->Form->create('Mymodel', array(
        'inputDefaults' => array(
            'error' => false
        )
    ));
    

    2) Get the current form errors from $this->validationErrors

    3) Display them where ever you prefer with your own markup or Cake’s default markup via $this->Form->error()

    UPDATE:
    I misunderstood your original question. The order of the elements can be specified via either the create() call (to apply to all fields) or an input() call (for an individual field):

    echo $this->Form->create('Mymodel', array(
        'inputDefaults' => array(
            'format' => array('before', 'error', 'label', 'between', 'input', 'after')
        )
    ));
    

    The above would place the error div before the label div. You can re-arrange that array in any order you prefer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that in MVVM: the View knows about the ViewModel the ViewModel knows
I understand that we need to create MXML file to define a view. Suppose
I understand that Perl's OO model is rather primitive; it is, in most respects,
I understand that 2.5 is automatically a double, and to make it a float,
I'm using CakePHP 2.0 and I'm trying to understand how I can echo dynamic
The time has come for me to understand MVC, so that's what I'm trying
I am currently trying to build a cakephp app that will list items from
I was explaining to our SEO specialist that cakephp url structure is domain/controller/view/params so
I'm working with CakePHP and trying to understand the best ways to make my
I understand that Web Site Projects compile source on-the-fly, and Web Application Projects pre-compile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.