Form check before render

Hello,
newbie here. I am rendering a form fieldset:

public function __construct()
{
    // we want to ignore the name passed
    parent::__construct('ProductDocumentationLanguageFieldset');

    $dh = DoctrineHelper::getInstance();

    $this -> setHydrator(new DoctrineHydrator($dh -> getEntityManager(), 'Application\Entity\Language\ProductDocumentationLanguage', false))
          -> setObject(new ProductDocumentationLanguage());
    $this->setAllowedObjectBindingClass('Application\Entity\Language\ProductDocumentationLanguage');

    $this->add(array(
        'name' => 'id',
        'type' => 'hidden',
    ));

    $this->add(array(
        'name' => 'group_id',
        'type' => 'hidden',
    ));

    $this->add(array(
        'name' => 'product_detail',
        'type' => 'hidden',
    ));



    $this->add(array(
        'type'    => 'DoctrineModule\Form\Element\ObjectSelect',
        'name'    => 'language',
        'attributes' => array(
            'class' => 'form-control'
        ),
        'options' => array(
            'label'          => 'Product language',
            'object_manager' => $dh->getEntityManager(),
            'target_class'   => 'Application\Entity\Language',
            'property'       => 'name',
            'empty_option'   => 'Select language',
            'is_method' => true,
            'find_method' => array(
                'name'   => 'findAll',
            ),
        ),
    ));
}

this will show me 2 dropdowns on frontend. I need to check, for each of the 2 dropdowns, the selected value on another db table, and if present set the dropdown disabled. How can achieve this?

Thanks a lot

nobody on this topic? really need help with this.
thanks

I think some informations are missing to help here.

Your form class contains only one Select element?!

The select element is disabled in the frontend after the reload or what is your goal here?

hi,
thanks for your answer. This class implements InputFilterProviderInterface, and generates 2 dropdowns. My goal is to have attribute disabled if the current selected value satisfy a condition (query on another table).

thanks

In the frontend via JavaScript or after the form was submited?

nope, this form is loaded from db, from a model: there is a table languages, and this model I’m getting has a foreign key on languages. so the first time I open this model, I select a language and save. Works like a charm. But the second time (and from now on) I open this model, have to check if the selected value I’ve chosen before, is present in another table (actually another db, I call a rest api), and if yes, the dropdown must be disabled. Hove I have been clear enough :slight_smile:
Thanks a lot!