ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Datebox: readonly and ALT+DOWN

MadJackal
8 Feb 2012 08:45:03 GMT
8 Feb 2012 08:45:03 GMT

Hello.
I use a datebox component just for show user date value. User can change it value only by click button.
I use this code

<datebox id="dateboxid" mold="rounded" format="dd.MM.yyyy" lenient="false" readonly="true" buttonVisible="false"/>

but if user click on datebox and press ALT+DOWN he can change value as if he had pressed the button.
how can i prevent this modification?
I see only one way, it's use

disabled="true"

but in GUI it looks not good

henrichen
8 Feb 2012 10:25:54 GMT
8 Feb 2012 10:25:54 GMT

Use disabled="true" and modified disabled css to look like read only.


index.zul
<zk>
<style>
.z-datebox-disd,
.z-datebox-focus .z-datebox-disd {
opacity: 1;
-moz-opacity: 1;
filter: alpha(opacity=100);
}
.z-datebox-text-disd {
background-color: #FFFFFF;
color: #000000 !important;
}
</style>
<zscript>
Date ddd = new Date();
</zscript>
<datebox value="${ddd}" disabled="true" buttonVisible="false"/>
<datebox value="${ddd}" readonly="true" buttonVisible="false"/>
<datebox value="${ddd}" buttonVisible="false"/>
</zk>