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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:49:08+00:00 2026-05-19T23:49:08+00:00

The system I’m working this is based around users and charity accounts, everyone has

  • 0

The system I’m working this is based around users and charity accounts, everyone has a user account but charities have a user account and a charity record tied to the user account with a user id that contains some extra fields.

I need one registration form that allows people to sign up as either an individual (with just a user account) or a charity (user account + charity record) so I’ve embedded the charity form into my user registration form and added a radio button question at the top to find out which type of account the user is signing up for.

What I need is that when the user indicates they want a charity account for the charity fields to become required and when they indicate they want to be an individual for them to not be (I hide them with Javascript when they select this).

I’ve tried running this when the user selects charity but it doesn’t seem to work:

$this->register_form->getEmbeddedForm('charity')->getValidator("name")->setOption("required", true)

Can anyone let me know what the correct way to do this is?

  • 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-19T23:49:09+00:00Added an answer on May 19, 2026 at 11:49 pm

    First of all it’s probably better to keep this logic within the form class instead of doing it in the action. Secondly when embedding a form it copies the validatorschema to the parent form, that’s why changing the option on the embedded form itself has no effect.

    Another way of accomplishing what you are trying to do could be this:

    class myForm extends BaseForm {
    
      public function configure() {
        // set up widgets, validators etc
      }
    
      protected function doBind($values) {
        is (!empty($values['charity']['charityCheckbox']) {
          $this->validatorSchema['charity']['name']->setOption('required', true);
        }
        parent::doBind($values);
      }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

System.Windows.Forms.Form has only one scroll event- Scroll , but it is necessary to recognize
System A captures X information from users via UI. This information is validated and
System.out.println( Arrays.deepToString( abc<def>ghi.split((?:<)|(?:>)) ) ); This prints [abc, def, ghi] , as if I
I want to count how many characters a certain string has in PHP, but
System.Text.RegularExpressions.Regex(#*#) is this correct..!? my text can be like #abc1234+as00# etc. ie, anything between
System.Collections.Concurrent has some new collections that work very well in multithreaded environments. However, they
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
System.Threading.WaitHandle (and hence ManualResetEvent etc) implement IDisposable explicitly. This seems to discourage it's use
System.Convert has a really useful utility for converting datatypes from one type to another.
System.Numerics.BigInteger lets you multiply large integers together, but is there anything of the same

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.