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

zk cleaning components

admin
9 Jan 2007 13:53:44 GMT
9 Jan 2007 13:53:44 GMT


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4094060

By: cmaniac

hi to all of you..

I have a question, I want to implement a clean button that clears all fields in a form of a window, all the fields have constraints like no-empy... haa...
and the clear method must be in the class associated within the *.zul file..

I have a method like:

AbstractComponent componente = (AbstractComponent) iteradorComponentes.next();

if (componente instanceof Datebox) {
Datebox componenteOriginal = (Datebox) componente;
componenteOriginal.setValue(null); <-- I try null... but....
}
else if (componente instanceof Decimalbox) {
Decimalbox componenteOriginal = (Decimalbox) componente;
componenteOriginal.setValue(new BigDecimal(0.0));
}
else if (componente instanceof Doublebox) {
Doublebox componenteOriginal = (Doublebox) componente;
componenteOriginal.setValue(new Double(0.0));
}
else if (componente instanceof Intbox) {
Intbox componenteOriginal = (Intbox) componente;
componenteOriginal.setValue(new Integer(0));
}
else if (componente instanceof Textbox) {
Textbox componenteOriginal = (Textbox) componente;
componenteOriginal.setValue(" ");
}
else if (componente instanceof Checkbox) {
Checkbox componenteOriginal = (Checkbox) componente;
componenteOriginal.setChecked(true); //esto deberia estar en ICONSTANTES
}
else if (componente instanceof FCKeditor) {
FCKeditor componenteOriginal = (FCKeditor) componente;
componenteOriginal.setValue(" ");
}

well... If I run de code... some fields especially Datebox and Textbox, did not clear at all, and the constraints especially no-empty triggers with de field still with data... (is a mess...)...

My queston is.. how I can clear all the fields in my window, so the constraints not trigger...???

admin
9 Jan 2007 14:04:18 GMT
9 Jan 2007 14:04:18 GMT


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4094078

By: matteo_barbieri

try with textbox.setRawValue("");

admin
25 Oct 2007 18:33:16 GMT
25 Oct 2007 18:33:16 GMT


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4588264

By: riznob

What about a Datebox? How does one clear a Datebox with an invalid date?

ricardovisk
18 Dec 2008 20:54:03 GMT
18 Dec 2008 20:54:03 GMT

What about a Datebox? How does one clear a Datebox with an invalid date?

RyanWu
22 Dec 2008 00:42:10 GMT
22 Dec 2008 00:42:10 GMT

in ZK's datebox, it can't be clear if you already choice some date,
but there's another workaround, just detach it and new a new same name datebox...

(maybe you can post the feature to ZK Features)