.FOCUS()

thread: 3 messages  |  last: a year ago  |  started: thursday, april 26, 2007, 9:43 am pdt


#1  |  tkaplan1983 (Melbourne, Fl) United States of America
Thursday, April 26, 2007, 9:43 AM PDT
<?php
    
class BeltEditPanel extends BeltEditPanelBase {
        
// Specify the Location of the Template (feel free to modify) for this Panel
        
protected $strTemplate 'generated/BeltEditPanel.tpl.php';
        public 
$txtColor;
        
        public function 
__construct($objParentObject$strClosePanelMethod$objBelt null$strControlId null) {
            try {
                
parent::__construct($objParentObject$strClosePanelMethod$objBelt$strControlId);
            } catch (
QCallerException $objExc) {
                
$objExc->IncrementOffset();
                throw 
$objExc;
            }
            
            
$this->txtColor_Create();
            
$this->btnSave_Create();
            
        }
        
        protected function 
txtColor_Create() {
          
$this->txtColor = new QTextBox($this);
          
$this->txtColor->Name QApplication::Translate('Color');
          
$this->txtColor->Text $this->objBelt->Color;
          
$this->txtColor->Required true;
          
$this->txtColor->MaxLength Belt::ColorMaxLength;
          
QApplication::ExecuteJavaScript(sprintf("document.getElementById('%s').focus()"$this->txtColor->ControlId));
        }

    }
?>

Im trying to focus the marker on the textbox but its not working.  I get an error everytime.  Any thoughts?

The Wierd thing is that this works no problem if I put the QApplication line in the BeltEditBase however when I override the function I get an error of

document.getElementById(“c12”) has no properties on line 192 in file xxx/xxx/_core/post.js

#2  |  tkaplan1983 (Melbourne, Fl) United States of America
Thursday, April 26, 2007, 10:59 AM PDT

Ah I figured it out everyone.  If you are having an issue and your a newb like me.

When doing a dash board this QApplication line needs to go in your function_construct.

Hope this helps.  Thanks ALL.

#3  |  Muthu kumar (India) India
Thursday, June 17, 2010, 2:57 AM PDT

try this one

protected function Form_Exit() {        
         
          $this->txtfieldname->Focus();
         
      }



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