×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
setFieldAttribute and Subform
Dariusz
New Member
Posts: 7
4 năm 11 tháng trước #4928
bởi Dariusz
setFieldAttribute and Subform was created by 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:
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?
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?
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Thời gian tải trang: 0.046 giây