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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:40:42+00:00 2026-05-25T20:40:42+00:00

I have a registration page and within this registration page the user will be

  • 0

I have a registration page and within this registration page the user will be required to fill in some interest, the interests values is called from a model with the name interest.php, all values are pulling through and saves as expected.

The relationship to the user model is

var $hasAndBelongsToMany = array(
        'Interest' => array(
            'className' => 'Interest',
            'joinTable' => 'users_interests',
            'foreignKey' => 'user_id',
            'associationForeignKey' => 'interest_id',
            'unique' => true,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'finderQuery' => '',
            'deleteQuery' => '',
            'insertQuery' => ''
        )

Whenever I add a validation rule in interest.php the little required star appears next to the checkboxes but it is not validating at all

<label for="InterestInterestId">Interests</label>
<input type="hidden" value="" name="data[Interest][interest_id]">
<div class="checkbox">
<input id="InterestInterestId8" type="checkbox" value="8" name="data[Interest][interest_id][]">
<label for="InterestInterestId8">Interest 1</label>
</div>
<div class="checkbox">
<input id="InterestInterestId1" type="checkbox" value="1" name="data[Interest][interest_id][]">
<label for="InterestInterestId1">Interest2</label>
</div>

in my view I call the multiple checkboxes like this

 echo $form->input('Interest.interest_id', array('label' => __l('Interests'), 'multiple' => 'checkbox'));

This is my validation rule in interest.php

$this->validate = array(

            'interest_id' => array(
                'rule' => array(
                    'equalTo',
                    '1'
                ) ,
                'message' => __l('Please select some interests')
            )
        );

Am I doing something wrong here, or missing something, any help will be appreciated!!!!

  • 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-25T20:40:43+00:00Added an answer on May 25, 2026 at 8:40 pm

    Found the answer with the help of this link HABTM form validation in CakePHP provided by bfavaretto

    The problem was this $this->User->Interest->set($this->data);

    I forgot to add it

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

Sidebar

Related Questions

I'm using ExtJS on a registration page which should have no effect on this.
Here is the situation, I have registration page that allows user to signup but
I have made customized user registration page. and i have made that on theme
So I have a registration page where the user registers with all his/her information
I have a login page where i can perform registration also .If a user
I have created Facebook registration page, What i want to do is user can
I have a registration page with fields for entering personal user info and it
In the registration page, I'm giving the user the option to fill most of
I have a user registration page where the user signs up for an event
I have a registration page and I am going to check the values of

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.