Is there a SetFocus method?

thread: 4 messages  |  last: about 3 years ago  |  started: thursday, february 9, 2006, 2:54 pm pst


#1  |  Netino (Sao Paulo, Brasil)
Thursday, February 9, 2006, 2:54 PM PST

When using 'ServerAction' feature, we lost the focus sequence on controls.

I will try to set focus in a control using javascript, but don't know where to begin.

If doesn't exists, would be a great feature.

Regards,
Netino

#2  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Thursday, February 9, 2006, 3:05 PM PST

There's nothing like that... but it's easy to do, especially with the new release...

If you want to set focus on some random $txtTextbox:

   QApplication::ExecuteJavaScript(sprintf(“document.getElementById('%s').focus()”,
       $txtTextbox->ControlId);

should do the trick.  Let me know if that works out ok.

#3  |  Netino (Sao Paulo, Brasil)
Thursday, February 9, 2006, 5:48 PM PST

Wow, is really simple!
But I need first to upgrade, and will post the result.

Thanks.
Netino

#4  |  syntaxtimawa (Davao City, Philippines) Philippines
Monday, February 11, 2008, 5:00 PM PST

Yep, it worked but I added a missing end parenthesis.

QApplication::ExecuteJavaScript(sprintf(“document.getElementById('%s').focus()”,
      $txtTextbox->ControlId) );


The latest qcodo version includes Focus() on some html elements

$txtTextbox->Focus();


Either ways worked.



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