I currently have a form that will let you create a family.
FamilyForm.php
$description = new Textarea(self::KEY_FAMILY_DESCRIPTION);
$description->setAttribute("id", self::KEY_FAMILY_DESCRIPTION);
$description->setLabel("Description");
$this->add($description);
$status = new Hidden(self::KEY_FAMILY_STATUS);
$status->setAttribute("id", self::KEY_FAMILY_STATUS);
$this->add($status);
$save = new Button(self::KEY_SAVE_BTN);
$save->setAttributes(array("id", self::KEY_SAVE_BTN));
$save->setLabel("Save");
$save->setValue("Save");
$this->add($save);
Create.phtml
<?php echo ctrlGroup($this, ProjectFamilyForm::KEY_FAMILY_DESCRIPTION, !($this->admin)); ?>
<?php echo ctrlGroup($this, ProjectFamilyForm::KEY_FAMILY_STATUS, !($this->admin)); ?>
<div class="form-actions">
<?php $save = $this->form->get(ProjectFamilyForm::KEY_SAVE_BTN); ?>
<?php $save->setAttribute("class", "btn btn-primary"); ?>
<?php echo $this->formSubmit($save); ?>
<a class="btn" href="<?php echo $this->url('home'); ?>">Cancel</a>
</div>
This works and allows me to input the description and the status of the family upon creation. However, everytime a family is created the status should be "active". However, the setValue() method seems to not be working.
Call to a member function setAttribute() on a non-objectsetAttributesin plural from andsetAttributein singular form. Relevant?. Or, are they 2 seperate methods?