protected function SetupPanel() { // Get and Validate the Other Object $this->mctOther = OtherContactInfoMetaControl::Create($this, $this->strUrlHashArgument, QMetaControlCreateType::CreateOnRecordNotFound); if (!$this->mctOther->EditMode) { // Trying to create a NEW Other $this->mctOther->OtherContactInfo->Person = $this->objPerson; $this->btnSave->Text = 'Create'; } else { // Ensure the Other object belongs to the person if ($this->mctOther->OtherContactInfo->PersonId != $this->objPerson->Id) { return $this->ReturnTo('#contact'); } $this->btnSave->Text = 'Update'; $this->btnDelete = new QLinkButton($this); $this->btnDelete->Text = 'Delete'; $this->btnDelete->CssClass = 'delete'; $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to permenantly DELETE this record?')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } $this->txtValue = $this->mctOther->txtValue_Create(); $this->txtValue->Required = true; $this->txtValue->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'btnSave_Click')); $this->txtValue->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtValue->CausesValidation = $this->btnSave->CausesValidation; $this->lstOtherContactMethod = $this->mctOther->lstOtherContactMethod_Create(); $this->lstOtherContactMethod->Required = true; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this OtherContactInfoMetaControl * @param QMetaControlCreateType $intCreateType rules governing OtherContactInfo object creation - defaults to CreateOrEdit * @return OtherContactInfoMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intId = QApplication::QueryString('intId'); return OtherContactInfoMetaControl::Create($objParentObject, $intId, $intCreateType); }