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

  • SEARCH
  • Home
  • 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 8486595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:59:19+00:00 2026-06-10T20:59:19+00:00

I am using entity registrations to let users register to an event. I have

  • 0

I am using entity registrations to let users register to an event. I have some fields that I want to validate depending on the value of other fields.

So, using hook_form_id_form_alter, i was able to add a second validation function. The second function is where i hoped I can add the code for validating the registration form.

function coastal_custom_form_registration_form_alter($form, &$form_state, $form_id) {
  $form['#validate'][] = 'event_registration_form_validate';  
}

But whenever I submit the form, the function that is supposed to do the validation never gets called.

//this function never gets called
function event_registration_form_validate(&$form, &$form_state){
  drupal_set_message('hi from validation');
  form_set_error('you are in form_registration');

}

I have been figuring how to do this for the whole day. Have anyone figured out how this is done? Thanks.

  • 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-10T20:59:20+00:00Added an answer on June 10, 2026 at 8:59 pm

    Reading the api documentation on hook_form_alter, I found out that you have to pass by reference $form. So the correct way of writing the function should be:

    function coastal_custom_form_registration_form_alter(&$form, &$form_state, $form_id) {
      $form['#validate'][] = 'event_registration_form_validate';  
    }
    

    Take note that there is an ampersand (&) before the $form variable.

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

Sidebar

Related Questions

Using Entity Framework I have the fields: o CreatedOn (datetime) o CreatedBy (nvarchar(50)) o
Using Entity Framework with MVC2, I have a series of date textboxes, that I
(USING ENTITY FRAMEWORK 4.3 CODE FIRST) The code is below. I want to actually
Scenario first :- I'm using Entity Framework to do some queries, to build my
I am using Entity Framework and I have two tables, a contact relationship table
I started using entity inheritance today with core data, does anyone have any experience
I am using Entity Framework Code First. I want to query entites from database
I am using Entity Framework CodeFirst where I have used Parent Child relations using
Using Entity Framework 4.3 in one of my data access classes I have generic
Using Entity Framework 4, MVC3, C# I have created a complex type within the

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.