public function Form_Validate() { $blnToReturn = parent::Form_Validate(); $blnFirst = true; $strMissingArray = array(); if (!$this->GetAmount()) { $strMissingArray[] = 'A Fund and/or Donation Amount is missing'; $this->GetControl('txtAmount0')->Select(); $blnFirst = false; } // Add validation for credit card numbers if ($this->pnlPayment->lstCcType->SelectedName == 'Discover' && substr($this->pnlPayment->txtCcNumber->Text, 0, 1) != '6') { $strMissingArray[] = 'The Account Number specified is not a valid Discover Card number'; } if ($this->pnlPayment->lstCcType->SelectedName == 'Mastercard' && substr($this->pnlPayment->txtCcNumber->Text, 0, 1) != '5') { $strMissingArray[] = 'The Account Number specified is not a valid Mastercard number'; } if ($this->pnlPayment->lstCcType->SelectedName == 'Visa' && substr($this->pnlPayment->txtCcNumber->Text, 0, 1) != '4') { $strMissingArray[] = 'The Account Number specified is not a valid Visa number'; } foreach ($this->GetErrorControls() as $objControl) { $objControl->Blink(); if ($objControl->ValidationError) { $strMissingArray[] = $objControl->ValidationError; } else { $strMissingArray[] = $objControl->Warning; } if ($blnFirst) { $objControl->Focus(); $blnFirst = false; } } if (count($strMissingArray)) { $blnToReturn = false; $this->lblMessage->Text = 'Please address the issues in the following fields:<ul>'; foreach ($strMissingArray as $strMissing) { $this->lblMessage->Text .= '<li>' . $strMissing . '</li>'; } $this->lblMessage->Text .= '</ul>'; $this->lblMessage->FontSize = '14px'; $this->lblMessage->FontBold = true; $this->lblMessage->ForeColor = '#844'; $this->lblMessage->Visible = true; $this->lblMessage->Blink(); $this->pnlPayment->btnSubmit_Reset(); QApplication::ExecuteJavaScript('document.location="#give";'); QApplication::ExecuteJavaScript('document.location="#";'); } else { if ($this->lblMessage->Visible) { $this->lblMessage->Visible = false; } } return $blnToReturn; }
public function Form_Validate() { $blnToReturn = parent::Form_Validate(); $blnFirst = true; foreach ($this->GetErrorControls() as $objControl) { $objControl->Blink(); if ($blnFirst) { $objControl->Focus(); $blnFirst = false; } } return $blnToReturn; }
protected function Form_Validate() { $blnToReturn = parent::Form_Validate(); if ($this->pnlAttributeOptions) { $strOptionNameArray = array(); foreach ($this->pnlAttributeOptions->GetChildControls() as $txtAttributeOption) { if (strlen(trim($txtAttributeOption->Text))) { $strKey = strtolower(trim($txtAttributeOption->Text)); if (array_key_exists($strKey, $strOptionNameArray)) { $txtAttributeOption->Warning = 'This is a duplicate'; $blnToReturn = false; } else { $strOptionNameArray[$strKey] = true; } } } if ($this->mctAttribute->EditMode) { foreach ($this->pnlAttributeOptions->GetChildControls() as $txtAttributeOption) { if (strlen(trim($txtAttributeOption->Text))) { $strName = trim($txtAttributeOption->Text); if (($objAttributeOption = AttributeOption::LoadByAttributeIdName($this->mctAttribute->Attribute->Id, $strName)) && $objAttributeOption->Id != $txtAttributeOption->ActionParameter) { $txtAttributeOption->Warning = 'This is a duplicate'; $blnToReturn = false; } } } } } return $blnToReturn; }
public function Form_Validate() { $blnToReturn = parent::Form_Validate(); // Check to ensure cost makes sense if ($this->txtDeposit->Visible) { if ($this->txtDeposit->Text >= $this->txtCost->Text) { $this->txtDeposit->Warning = 'Deposit must be less than the overall cost'; $blnToReturn = false; } } if ($this->txtMinimumQuantity) { if ($this->txtMaximumQuantity->Text < $this->txtMinimumQuantity->Text) { $this->txtMaximumQuantity->Warning = 'Maximum Quantity must be greater or equal to Minimum Quantity'; $blnToReturn = false; } } if ($this->dtxDateStart->DateTime && $this->dtxDateEnd->DateTime) { if ($this->dtxDateEnd->DateTime->IsEarlierThan($this->dtxDateStart->DateTime)) { $this->dtxDateEnd->Warning = 'Date Unavailable must be after Date Available'; $blnToReturn = false; } } $blnFirst = true; foreach ($this->GetErrorControls() as $objControl) { $objControl->Blink(); if ($blnFirst) { $objControl->Focus(); $blnFirst = false; } } return $blnToReturn; }