Transition from IIS to Apache... cant get sample.php to work.

thread: 3 messages  |  last: about 2 years ago  |  started: thursday, april 16, 2009, 7:12 am pdt


#1  |  DigitalMechanic (Media, PA) United States of America
Thursday, April 16, 2009, 7:12 AM PDT

Hi,

I recently inherited a qcodo based project and I'm a little lost. Trying to transition from IIS to Apache as mandated by my project requirements and I keep running into a an AJAX error that I can't resolve. “An error occurred during AJAX Response parsing.” - I saw the postings about this error in the other forums but they don't seem to be the same root cause.

So I decided to back out and just try the simple sample.php and see if I was installed correctly. When I run sample.php, the form is rendered and I click the “Click Me” button, the following error page is presented:

Undefined SET property or variable in 'QLabel' class: t
Exception Type:   QUndefinedPropertyException

Source File:   /var/www/html/gp/sample.php     Line:   25

Line 20:                $this->btnButton->Text = 'Click Me';
Line 21:                $this->btnButton->AddAction(new QClickEvent(), new QServerAction('btnButton_Click'));
Line 22:            }
Line 23:    
Line 24:            protected function btnButton_Click($strFormId, $strControlId, $strParameter) {
Line 25:                $this->lblMessage->t = 'Hello, World!';
Line 26:            }
Line 27:        }
Line 28:    
Line 29:        SampleForm::Run('SampleForm');
Line 30:    ?>


Call Stack:

#0 /var/www/html/gp/includes/qcodo/_core/qform/QControlBase.class.php(1265): QBaseClass->__set('t', 'Hello, World!')
#1 /var/www/html/gp/includes/qcodo/_core/qform/QBlockControl.class.php(425): QControlBase->__set('t', 'Hello, World!')
#2 /var/www/html/gp/sample.php(25): QBlockControl->__set('t', 'Hello, World!')
#3 /var/www/html/gp/includes/qcodo/_core/qform/QFormBase.class.php(657): SampleForm->btnButton_Click('SampleForm', 'c2', '')
#4 /var/www/html/gp/includes/qcodo/_core/qform/QFormBase.class.php(774): QFormBase->TriggerMethod('c2', 'btnButton_Click')
#5 /var/www/html/gp/includes/qcodo/_core/qform/QFormBase.class.php(242): QFormBase->TriggerActions()
#6 /var/www/html/gp/sample.php(29): QFormBase::Run('SampleForm')
#7 {main}


I must have a configuration issue somewhere... any ideas are greatly appreciated.

Thanks in advance,

-DM

DigitalMechanic

#2  |  VexedPanda (Calgary, AB) Canada
Thursday, April 16, 2009, 9:47 AM PDT

I'm not sure why line 25 is just $this->lblMessage->t
The error is correct, the QLabel class does not have a property “t”. Try “Text” instead.

#3  |  DigitalMechanic (Media, PA) United States of America
Monday, April 20, 2009, 7:06 PM PDT

I think the person who wrote this messed with the sample code... I was able to get a fresh install of qcodo to work - the problem I'm now running into is still baffling me - and I think it may be connected to the whole transition from IIS to linux...

I have a form and template that gets stuck on an Ajax issue the generated code that gets to the browser is:

<html>
2<head>
3<title>Government Pricing Client Selection</title>
4<link rel=“stylesheet” type=“text/css” href=“css/styles.css” />
5</head>
6<body>
7<div class=“ContentPanel”>
8<div class=“CenteredPanel”>
9<table width=“100%” height=“96%” cellspacing=“0” cellpadding=“0”
10 border=“0”>
11 <tr valign=“middle”>
12 <td width=“100%” height=“100%” align=“center”>
13
14 <div id=“clientselbox” class=“centered”>
15 <table width=“100%” border=“0” cellspacing=“0” cellpadding=“0”>
16 <tr>
17 <td style=“background-color: #c41130”><form method=“post” id=“ClientSelection” action=“/client_sel.php”>
18<script type=“text/javascript” src=“/assets/js/_core/qcodo.js”></script>
19<script type=“text/javascript” src=“/assets/js/_core/logger.js”></script>
20<script type=“text/javascript” src=“/assets/js/_core/event.js”></script>
21<script type=“text/javascript” src=“/assets/js/_core/post.js”></script>
22<script type=“text/javascript” src=“/assets/js/_core/control.js”></script>
23<script type=“text/javascript” src=“/assets/js/_core/listbox.js”></script>
24<script type=“text/javascript”>document.getElementById('c3').focus(); </script>


The template just stops getting spit out at this point (above). The form code that seems to be getting stuck is as follows:

<?php
require_once('includes/prepend.inc.php');
require('includes/nocache.inc.php');

class LoginForm extends QForm {
       protected $txtUsername;
       protected $txtPassword;
       protected $lblMessage;

       protected $btnLogin;
       protected function Form_Create() {
               $this->txtUsername = new QTextBox($this);
               $this->txtUsername->Name = 'username';
               $this->txtUsername->CausesValidation = true;
               $this->txtUsername->Required = true;
               $this->txtUsername->Columns = 37;
               $this->txtPassword = new QTextBox($this);
               $this->txtPassword->CausesValidation = true;
               $this->txtPassword->Required = true;
               $this->txtPassword->Name = 'password';
               $this->txtPassword->TextMode = QTextMode::Password;
               $this->txtPassword->Columns = 37;
               $this->lblMessage = new QLabel($this);
               $this->lblMessage->Text = ““;
               $this->lblMessage->CausesValidation = true;
               $this->lblMessage->HtmlEntities = false;
               $this->btnLogin = new QButton($this);
               $this->btnLogin->CausesValidation = true;
               $this->btnLogin->Text = QApplication::Translate('Login');
               $this->btnLogin->AddAction(new QClickEvent(), new QAjaxAction('btnLogin_Click'));
               $this->btnLogin->PrimaryButton = true;
               QApplication::ExecuteJavaScript(sprintf(“document.getElementById('%s').focus()”,
               $this->txtUsername->ControlId) );
               if (isset($_SESSION['User'])) {
                       $this->lblMessage->Text = “You have been logged out successfully.”;
               }
               unset($_SESSION['SelectedClient']);
               unset($_SESSION['User']);

       }
       protected function Form_Load() {
               $this->lblMessage->Text = ““;
       }
       protected function btnLogin_Click($strFormId, $strControlId, $strParameter) {
               $this->lblMessage->Text = ““;
               $objUser = User::LoadByUserName($this->txtUsername->Text);
               if ($objUser && $objUser->IsLocked) {
                       $this->lblMessage->HtmlEntities = false;
                       $this->lblMessage->Text = “Your account has been locked.<br>Please contact the system administrator for assistance.”;
                       return;
               }
               if (!$objUser || $objUser->Password != sha1($this->txtPassword->Text)) {
                       $this->txtPassword->Text = ““;
                       try{
                               if ($objUser) {
                                       $objUser->FailedAttempts += 1;
                                       if ($objUser->FailedAttempts < 3) {
                                               try{
                                                       $objUser->Save();
                                               }
                                               catch (QCallerException $objExc) {
                                                       $objExc->IncrementOffset();
                                                       QApplication::DisplayAlert($objExc->getMessage());
                                               }
                                               $this->lblMessage->Text = “Unknown user or password”;
                                       }
                                       else {
                                               if (!$objUser->IsLocked) {
                                                       $objUser->IsLocked = true;
                                                       try{
                                                               $objUser->Save();
                                                       }
                                                       catch (QCallerException $objExc) {
                                                               $objExc->IncrementOffset();
                                                               QApplication::DisplayAlert($objExc->getMessage());
                                                       }
                                                       $this->lblMessage->Text = “Your account has been locked. Please contact the system administrator for assistance.”;
                                               }
                                       }
                               }
                               else {
                                       $this->lblMessage->Text = 'Unknown user or password';
                               }
                       }
                       catch (QCallerException $objExc) {
                               $objExc->IncrementOffset();
                               QApplication::DisplayAlert($objExc->getMessage());
                       }
                       return;
               }

               $objUser->FailedAttempts = 0;
               try{
                       $objUser->Save();
               }
               catch (QCallerException $objExc) {
                       $objExc->IncrementOffset();
                       QApplication::DisplayAlert($objExc->getMessage());
               }
               $_SESSION['User'] = serialize($objUser);
               if ($objUser->IsAdmin) {
                       QApplication::Redirect(_VIRTUAL_DIRECTORY_ . '/client_list.php');

               }
               else {
                       QApplication::Redirect(_VIRTUAL_DIRECTORY_ . '/client_sel.php');
               }
       }
}
LoginForm::Run('LoginForm', 'login.tpl.php');
?>


Sorry to post so much code - but I figured it might help...

Please advise...

-DM

Thanks



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.