zk - java textbox validation before fileupload -
i have textbox , button upload = true attribute component in zk framework , control textbox value, if empty or not, before upload dialog pops up. tried onchange event on textbox disable , enable button according value problem button not enabled/disabled before clicking somewhere else. if write text in textbox , after click on button, still remains diabled. after second click gets activated.
you should use onchanging instead of onchange. also, zk-side solution working correctly zk + java side solution not working want.
zk-side solution ( working )
<zk> <textbox> <attribute name="onchanging"> if ( event.getvalue().length() > 0 ) but.setdisabled( false ); else but.setdisabled( true ); </attribute> </textbox> <button id="but" disabled="true" upload="true,maxsize=300" label="up" /> </zk> zk + java solution ( not working properly )
zk
<window title="hello world!!" border="normal" width="200px" apply="com.uploadfile"> <textbox id="value" /> <button id="but" disabled="true" upload="true,maxsize=300" label="up" /> </window> java
public class uploadfile extends genericforwardcomposer<window> { private static final long serialversionuid = 1l; private textbox value; private button but; public void onchanging$value() { if ( value.getvalue().length() > 0 ) but.setdisabled( false ); else but.setdisabled( true ); } public void onclick$but() { alert(value.getvalue()); } }
Comments
Post a Comment