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 7567287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:37:42+00:00 2026-05-30T14:37:42+00:00

I have a form that it seems to me Cake is making fields required

  • 0

I have a form that it seems to me Cake is making fields required or not required so randomly that I can’t even control it. Please help me to understand how to get required fields working.

public $validate = array(
    'fname' => array(
        'rule1' => array(
            'rule' => 'notEmpty',
            'message' => 'Please enter your first name'
        ),
        'rule2' => array(
            'rule' => array('maxLength', '50'),
            'message' => 'First name cannot exceed 50 characters'
        )
    ),
    'sname' => array(
        'rule1' => array(
            'rule' => 'notEmpty',
            'message' => 'Please enter your last name'
        ),
        'rule2' => array(
            'rule' => array('maxLength', '50'),
            'message' => 'Last name cannot exceed 50 characters'
        ),
    ),
    'email' => array(
        'rule1' => array(
            'rule' => 'notEmpty',
            'message' => 'Please enter your email address'
        ),
        'rule2' => array(
            'rule' => array('maxLength', 100),
            'message' => array('Email cannot exceed 100 characters')
        ),
        'rule3' => array(
            'rule' => 'email',
            'message' => 'Please enter a valid email address'
        ),
        'rule4' => array(
            'rule' => 'isUnique',
            'message' => 'An account already exists with that email address',
            'on' => 'update'
        )
    )
);

All these 3 fields cannot be empty, but Cake is deciding to make fname and sname show as required on the form, but email is not required. I’m talking about the class on the inputs making it look required. This is so random. In the database the fields are all identical VARCHAR, NOT NULL.

I tried adding allowEmpty => false to the email but it doesn’t do anything. This works on other fields that only have one rule but doesn’t work on fields that have multiple rules. Still, I want to know why it is making fname and sname required but not email.

Screenshot: https://i.stack.imgur.com/imeqW.gif

  • 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-05-30T14:37:43+00:00Added an answer on May 30, 2026 at 2:37 pm

    Hi in the table for email field make it as could not be

    NULL

    (I think email column can accept null values like that u created the table) then it Required * symbol will come on view. Surely it will work, I face the same issue like this

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

Sidebar

Related Questions

I have a date string of the form '2009/05/13 19:19:30 -0400'. It seems that
I have a form that contains a GridView control which is databound to an
I have a form that has multiple fields, and for testing purposes is there
I have a form that is composed of a couple of text fields and
I have a form where users can enter tags like tag1,tag2,tag3. I explode that
I have a form that seems to never validate. The form is just three
Have a form that is not being read by serialize() function. <script type=text/javascript> function
I have a form that consists of: 3 text boxes (first two are required
I have form that displays several keywords (standard set of choice lists that changes
I currently have form that checks if a user has unsubmitted changes when they

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.