Hi Clemens,
the id in addMessage() is still wrong.
At least the id of the tc:page is missing.
Please take a look into the generated html source for the correct id of the
<input ..> generated by the tc:date.
Regards,
Volker
2007/5/25, Clemens Sietas <[EMAIL PROTECTED]>:
Hello Helmut,
thank you for your help!
Now I have the following Client- and Server-Code (below).
The Message is always added (facesContext.addMessage)
in an action-method of my code just for testing.
However, I never get a message displayed.
Is there something wrong on the client or server.
To be honest I never got any message working before.
I did some testing with messages a few weeks ago.
I have no luck with the message functionality, although
it seems to be quite easy. Do you have any more help?
Thank you in advance
Clemens
Client:
<f:subview id="dlgAddEdit">
...
<tc:panel>
...
<tx:date id="vldtyBeg"
value="#{controller.selectedVldtyBeg}"
label="#{controller.keyLblValidityBegin}"
readonly="#{controller.forEditSelected}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tx:date>
<tx:date id="vldtyEnd"
value="#{controller.selectedVldtyEnd}"
label="#{controller.keyLblValidityEnd}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tx:date>
<tc:message for="vldtyEnd"/>
...
</tc:panel>
Server:
FacesContext facesContext = FacesContext.getCurrentInstance();
String message = "vldtyEnd smaller than vldtyBeg";
facesContext.addMessage("dlgAddEdit:vldtyEnd",
new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
> Hello Clemens,
>
> you have to specify the id of input component not of the message component
> in addMessage().
> For example
>
> facesContext.addMessage("myPage:vldtyEnd",
> new FacesMessage(FacesMessage.SEVERITY_ERROR, message,
> message));
>
>
> Regards
> Helmut
>
> ----- Original Message -----
> From: "Clemens Sietas" <[EMAIL PROTECTED]>
> To: "MyFaces Discussion" <[email protected]>
> Sent: Wednesday, May 23, 2007 11:42 AM
> Subject: Re: [Tobago] tx:date EndDate not before BeginDate
>
>
> > Hello Udo,
> >
> > I found something like that, however, it does not
> > work. No message is displayed.
> > Do I use the wrong id when adding the message?
> > The message is generated in any case just for testing.
> >
> > Thanks for any help!
> > Clemens
> >
> >
> > Client:
> > <tc:panel>
> > ...
> > <tx:date id="vldtyBeg"
> > value="#{controller.selectedVldtyBeg}"
> > label="#{controller.keyLblValidityBegin}"
> > readonly="#{controller.forEditSelected}">
> > <f:convertDateTime pattern="dd.MM.yyyy"/>
> > </tx:date>
> > <tx:date id="vldtyEnd"
> > value="#{controller.selectedVldtyEnd}"
> > label="#{controller.keyLblValidityEnd}">
> > <f:convertDateTime pattern="dd.MM.yyyy"/>
> > </tx:date>
> > <tc:message for="vldtyEnd" id="msgForVldtyEnd"/>
> > ...
> > </tc:panel>
> >
> >
> > Server:
> >
> > FacesContext facesContext = FacesContext.getCurrentInstance();
> >
> > String message = "EndDate smaller than BeginDate";
> > facesContext.addMessage("msgForVldtyEnd",
> > new FacesMessage(FacesMessage.SEVERITY_ERROR, message,
> > message));
> >
> >
> >
> >
> > -------- Original-Nachricht --------
> > Datum: Wed, 23 May 2007 07:47:08 +0200
> > Von: "Clemens Sietas" <[EMAIL PROTECTED]>
> > An: "MyFaces Discussion" <[email protected]>
> > Betreff: Re: [Tobago] tx:date EndDate not before BeginDate
> >
> >> Hello Udo,
> >>
> >> thank you for the reply.
> >> I will try both options.
> >>
> >> Regards,
> >> Clemens
> >>
> >>
> >> > I only see 2 options, both standard JSF:
> >> >
> >> > 1. check "manually" in the action method, use
> >> facesContext.addMessage()
> >> > 2. write your own validator
> >> >
> >> > I don't know a more declarative way in the moment.
> >> >
> >> > Regards,
> >> >
> >> > Udo
> >> >
> >> > Clemens Sietas schrieb:
> >> > > Hello,
> >> > >
> >> > > I have another question regarding the datepicker.
> >> > > Can I easily ensure in JSF-coding that the
> >> > > selectedVldtyEnd cannot be selected with a smaller date
> >> > > than the selectedVldtyBeg?
> >> > > For example with <f:validate...>
> >> > >
> >> > > Regards,
> >> > > Clemens
> >> > >
> >> > > <tx:date id="vldtyBeg"
> >> > > value="#{controller.selectedVldtyBeg}"
> >> > > label="#{controller.keyLblValidityBegin}"
> >> > > readonly="#{controller.forEditSelected}">
> >> > > <f:convertDateTime pattern="dd.MM.yyyy"/>
> >> > > </tx:date>
> >> > > <tx:date id="vldtyEnd"
> >> > > value="#{controller.selectedVldtyEnd}"
> >> > > label="#{controller.keyLblValidityEnd}">
> >> > > <f:convertDateTime pattern="dd.MM.yyyy"/>
> >> > > </tx:date>
> >> > >
> >> > >
> >>
> >> --
> >> --------------------------------------------
> >> Clemens Sietas
> >> email: [EMAIL PROTECTED]
> >> --------------------------------------------
> >>
> >
> > --
> > --------------------------------------------
> > Clemens Sietas
> > email: [EMAIL PROTECTED]
> > --------------------------------------------
> >
> >
> >
>
--
--------------------------------------------
Clemens Sietas
email: [EMAIL PROTECTED]
--------------------------------------------