Custom field check box with text area

Discussion in 'aMember Pro v.4' started by neverknow1, Nov 28, 2012.

  1. neverknow1

    neverknow1 Member

    Joined:
    Jan 8, 2007
    Messages:
    36
    Good day,

    Is there any way to create a custom field with checkbox and text area at the same time?

    Example: I will create a custom field Name - user can inserte text and check the check box.

    Thanks in advance!
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    No by default you can do this cia custom brick only.
    Here is example of such brick:
    PHP:
    class Am_Form_Brick_CustomField extends Am_Form_Brick
    {
        protected 
    $hideIfLoggedInPossible self::HIDE_DONT;
        
        public function 
    __construct($id null$config null)
        {
            
    $this->name ___("Custom checkbox/textarea field");
            
    parent::__construct($id$config);
        }
        
        public function 
    isAcceptableForForm(Am_Form_Bricked $form
        {
            return 
    $form instanceof Am_Form_Signup;
        }
        public function 
    initConfigForm(Am_Form $form)
        {
        }

        public function 
    insertBrick(HTML_QuickForm2_Container $form)
        {
           
    $gr =  $form->addGroup('custombrick')->setLabel('Custom field');
           
    $gr->addCheckbox('custom_checkbox');
           
    $gr->addTextarea('custom_textarea');
        }
        
    }

  3. neverknow1

    neverknow1 Member

    Joined:
    Jan 8, 2007
    Messages:
    36
    Thanks for the reply Alexander!! I will try that. Thank you again.

Share This Page