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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:40:18+00:00 2026-05-23T22:40:18+00:00

I am making a custom ActiveForm method, but it requires the model to have

  • 0

I am making a custom ActiveForm method, but it requires the model to have a certain custom validator attached the the attribute that is being passed through (otherwise who knows what will happen!?)

My question is simply… is there a way to run this check in the code that is reliable?

I don’t want to add the validator at runtime. That would create confusion and possibly let someone use this type of field where it ought not be used.

So I want to say something like:

if( model NOT HAVE validationMethod ON property)
  throw Exception;
  • 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-23T22:40:18+00:00Added an answer on May 23, 2026 at 10:40 pm

    I’m also not sure why you want to do this, but in addition to viewing the rules array you can do:

    $model->getValidators($attribute)

    to check which validators are active for a particular attribute (or all attributes, if the arg is null. (I’m assuming $attribute = property in your example.)

    This will return all the validator objects that are active for the current scenario and you can check if a predefined or custom class exists. It also gets you a bit more info than just the rules array (i.e., the properties of the validator class).

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

Sidebar

Related Questions

Hi im making a custom Textbox i got everty thing working but how do
I am making an application that does some custom image processing. The program will
I am making custom NSScrollers for use in NSScrollView. But when any of the
What is the process behind making custom widgets (using Qt) that don't look...well...ugly? I
I have tried and tried to achieve an SQL injection by making custom queries
I'm making a custom input method for the iPad, I want to be able
I'm making a custom slider component. The head (the thing that you drag) is
I'm making a custom view that I want to be bindings/core data compatible and
This is beyond both making sense and my control. That being said here is
Does anybody know the logic behind making DataSourceSelectArguments sealed? I've implemented a custom DataSource

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.