× Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues

setFieldAttribute and Subform

4 år 11 måneder siden #4928 af Dariusz
setFieldAttribute and Subform blev oprettet af Dariusz
Hi, I have a question. I created a form with a subform. Due to the complex validation, I decided to add form attributes in the getForm method like that:
    public function getForm($data = array(), $loadData = true)
    {
        // Get the form.
        $form = $this->loadForm('com_evisit.visit', 'visitform', array(
                        'control'   => 'jform',
                        'load_data' => $loadData
                )
        );

        if (empty($form))
        {
                return false;
        }

       $form->setFieldAttribute('myfield', 'required', 'true');

        return $form;
    }



And it works ok. The field "myfield" becomes required depending on the scenario.

Unfortunately, this case works only for the current form. Does not work for the subform.

Will somebody lead me?

Venligst Log på eller Opret en konto for at deltage i samtalen

Tid til at oprette siden: 0.079 sekunder
Leveret af Kunena Forum

Vi we benytter cookies, så vi bedst muligt kan levere vores services. For mere information, se vores