0

Can i handle onFocus event in Composer for div tag declared in ZUL?

asked 2010-07-29 08:13:02 +0800

drajasuman gravatar image drajasuman
342 1

Hi, Iam Using DIV tag in ZUL.
Can i handle onFocus event in Composer for div tag declared in ZUL?

example:

<div id="test" style="font-weight:bold;border:2px solid green" focus="true">

Can i handle onFocus event in COntroller?

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2010-07-29 08:26:56 +0800

Arsen gravatar image Arsen
382 5

It seems div can't take focus. As workaround you can put some "invisible" control (ex. textbox with with = 1px and no border) on div to catch focus.

link publish delete flag offensive edit

answered 2010-07-30 00:35:10 +0800

drajasuman gravatar image drajasuman
342 1

Hi.
Iam looking for a container (like window or panel or any thing) which can have border and also handle focus event.

link publish delete flag offensive edit

answered 2010-07-30 05:23:58 +0800

drajasuman gravatar image drajasuman
342 1

Hi.. can u give one example..How can we keep a textbox control on DIV?

link publish delete flag offensive edit

answered 2010-07-30 07:12:08 +0800

Arsen gravatar image Arsen
382 5

Of course

<window title="My First Window" border="normal" width="200px">
 <textbox id="firstTextbox"/>
<div>
      This is my div
      <textbox id="focusCatcher" width="1px" style="border: 0px" onFocus="alert(1)"/>
</div>
</window>

link publish delete flag offensive edit

answered 2010-07-30 07:28:47 +0800

drajasuman gravatar image drajasuman
342 1

Hi Arsen, In my case i have many textboxes inside div.
In this scenario i have to give onFocus for each and every textbox.
Iam looking for a container becuase, if i can handle focus at one point.

link publish delete flag offensive edit

answered 2010-07-30 07:55:47 +0800

drajasuman gravatar image drajasuman
342 1

<?page id="user"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">


<window id="userWindow" title="User" maximizable="true" minimizable="true" closable="true" height="70%" width="40%" style="background:#6699FF" apply="in.usit.security.controller.UserController" >
<div id="userDIV" height="50%" width="80%">
<h:table id="userTable" width="100%" align="center" border="0" >
<h:tr>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.loginid')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="loginId" value="" />
</h:td>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.pwd')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="loginPwd" type="password" value="" />
</h:td>
<h:td></h:td>
</h:tr>

<h:tr>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.name')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="userName" value="" />
</h:td>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.confirmpwd')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="confirmPwd" type="password" value="" />
</h:td>
<h:td></h:td>
</h:tr>

<h:tr>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.type')}" />
</h:td>
<h:td width="5%" colspan="2">
<combobox id="userType" cols="17" value="" />
</h:td>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.designation')}" />
</h:td>
<h:td width="5%" colspan="2">
<combobox id="designation" cols="17" value="" />
</h:td>
<h:td></h:td>
</h:tr>

<h:tr>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.validfrom')}" />
</h:td>
<h:td width="5%" colspan="2">
<datebox id="validFrom" cols="17" readonly="true" format="dd/MM/yyyy"/>
</h:td>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.validupto')}" />
</h:td>
<h:td width="5%" colspan="2">
<datebox id="validUpTo" cols="17" readonly="true" format="dd/MM/yyyy" />
</h:td>
<h:td></h:td>
</h:tr>

<h:tr>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.email')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="email" value="" />
</h:td>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.officephno')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="officePhNo" value="" />
</h:td>
<h:td></h:td>
</h:tr>

<h:tr>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.mobileno')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="mobilePhNo" value="" />
</h:td>
<h:td width="15%" align="right" colspan="1">
<label value="${c:l('user.housephno')}" />
</h:td>
<h:td width="5%" colspan="2">
<textbox id="housePhNo" value="" />
</h:td>
<h:td></h:td>
</h:tr>
</h:table>
</div>
<separator bar="false" height="2%"/>

<div id="userDeptDIV" height="40%" width="80%">
<h:table id="userDeptTable">
<h:tr>
<h:td>
<grid id="userDeptDetails" mold="paging" pagingPosition="both" pageSize="8">
<columns>
<column label="${c:l('user.select')}" />
<column label="${c:l('user.dept')}" />
<column label="${c:l('user.tree')}" />
<column label="${c:l('user.active')}" />
</columns>
<rows id="userDeptDetailRows">
</rows>
</grid>
</h:td>
</h:tr>

</h:table>
</div>

</window>
</zk>

link publish delete flag offensive edit

answered 2010-08-02 07:28:28 +0800

drajasuman gravatar image drajasuman
342 1

updated 2010-08-02 08:40:52 +0800

I want to handle onFocus event for containers like window, Panel or DIV...
So that i can be free from handling the focus events from the other components that are inside the DIV.
As in my application, i need to do catch onFocus for the containers..

Arsen: If i take a textbox which is hidden. Hw it will take focus?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-07-29 08:13:02 +0800

Seen: 473 times

Last updated: Aug 02 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More