public static function Run($strFormId, $strAlternateHtmlFile = null) { // Ensure strFormId is a class $objClass = new $strFormId(); $objClass->strFormId = $strFormId; // Ensure strFormId is a subclass of QForm if (!$objClass instanceof MJaxForm) { throw new QCallerException('Object is not a subclass of MJaxForm (note, it can NOT be a subclass of QFormBase): ' . $strFormId); } //Check to see if the form has posted data if (key_exists(MJaxFormPostData::MJaxForm__FormState, $_POST)) { //Tell the object and the application what the call type is $strPostDataState = $_POST[MJaxFormPostData::MJaxForm__FormState]; if ($strPostDataState) { // We might have a valid form state -- let's see by unserializing this object $objClass = MJaxForm::Unserialize($strPostDataState); } $objClass->ParsePostData(); $objClass->strCallType = QCallType::Ajax; QApplication::$RequestMode = QRequestMode::Ajax; } elseif (key_exists(MJaxFormPostData::ACTION, $_POST) && $_POST[MJaxFormPostData::ACTION] == MJaxFormAction::CHANGE_PAGE) { $objClass->strCallType = QCallType::Ajax; QApplication::$RequestMode = QRequestMode::Ajax; $objClass->Form_Create(); } else { $objClass->strCallType = QCallType::None; QApplication::$RequestMode = QRequestMode::Standard; $objClass->Form_Create(); } if (key_exists(MJaxFormPostData::ACTION, $_POST)) { self::$strCurrAction = $_POST[MJaxFormPostData::ACTION]; switch (self::$strCurrAction) { case MJaxFormAction::CONTROL_EVENT: $objClass->TriggerControlEvent($_POST[MJaxFormPostData::CONTROL_ID], $_POST[MJaxFormPostData::EVENT]); break; } } $objClass->Form_PreRender(); if ($objClass->strCallType == QCallType::Ajax) { $objClass->RenderAjax(); } else { $objClass->Render(); } $objClass->Form_Exit(); }