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

setting error message to label

ommpavan
9 Dec 2011 07:41:08 GMT
9 Dec 2011 07:41:08 GMT

hai

Assume i have a Question description as Label and answers as Radiogroup .when if user dont selecting answer i am throwing wrong value exception to the label .
like

throw new WrongValueException(questionDesctionLabel
,Labels.getLabel("label_ChecList_Must_SelectAnswer"));


it is working fine but after selecting answer then rise save button the error message is still not clearing even i selected answer .for textboxes we made it usingtextbox.setErrorMeassage(" ") then how to remove error message for label which produced by worngvalue exception.

please replay fast i need it very urgent

terrytornadoTop Contributor
9 Dec 2011 08:47:37 GMT
9 Dec 2011 08:47:37 GMT

yourComponent.clearErrorMessage();

best
Stephan

ommpavan
10 Dec 2011 05:00:49 GMT
10 Dec 2011 05:00:49 GMT

hai stephan

as you said and as i required
if i take
Label quetionLabel=new Label();
quetionLabel.clearErrorMessage();

but there is no method for Label clearErrorMessage() .beacuse it is not an input element .if i worte that method it is asking for cast to InputElement then showing canot cast from label to input element .
Again i am explaining my issue

Label questionDesctionLabel=new Label();

throw new WrongValueException(questionDesctionLabel ,Labels.getLabel("label_ChecList_Must_SelectAnswer"));

here i can see error message ,now i have to remove it with out closing error meassage manually .error message should be cleared automatically by some method of label
where setErrorMessage(),clearErrorMessage() are not for the Label

terrytornadoTop Contributor
10 Dec 2011 08:51:45 GMT
10 Dec 2011 08:51:45 GMT

Hi ommpavan,

not tested but have a try with a little trick. Put a very small input component right next the label and let these comp show the errorMessage.
By playing with the css style you can made it nearly invisible.

<hbox>
<label/>
<textbox width="1px" />
</hbox>

best
Stephan

ommpavan
10 Dec 2011 16:07:17 GMT
10 Dec 2011 16:07:17 GMT

Finally i have done with Textbox only .but if i can clear the error message of Label it should sounds good.Thank you sthephan .ZK ....Rocks

alfcova
23 Feb 2012 19:03:18 GMT
23 Feb 2012 19:03:18 GMT

I guess you can clear the error message from any component using

Clients.clearWrongValue(Component comp);

I'm using ZK 5.0.9

best
Fonz