Hi Ken,
For info on myfaces/tomahawk tags go here:
http://myfaces.apache.org/javadoc.html
Using the TLD(Tomahawk) link, you can info on the t:inputText component,
which does have this attribute.
The attribute isn't on the standard h:inputText component, ie it's a
tomahawk extension, available only if you use the t:inputText component
instead of h:inputText (and include tomahawk in your classpath).
I don't know whether the behaviour you see with the normal one
(required=true causes error for components when readonly=true) also
applies to Sun's JSF implementation but I wouldn't be at all surprised.
Web browsers don't send data back unless the field is editable, and if
the JSF implementation (of any brand) doesn't see data for a required
field then it has to complain.
Maybe a JSF impl could work around this by putting the values of
readonly fields into hidden input fields instead so they *are* present
on postback but AFAIK MyFaces doesn't do that (and I'm not sure whether
there are other problems that would be caused by that).
It seems to me that your options are:
(a) Remove the "required=true" attribute from the input field and
instead implement the check in your action methods.
(b) use t:inputText and disabledOnClientSide=true
Regards,
Simon
ken carlino wrote:
I am looking at this documentation,
http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/renderkitdocs/HTML_BASIC/javax.faces.Inputjavax.faces.Text.html
I don't see it has the '"disabledOnClientSide" attribute.
Thanks.
On 10/29/06, ken carlino <[EMAIL PROTECTED]> wrote:
Thanks. Is this '"disabledOnClientSide" a JSF standard attribute (JSF
1.0? 1.1?) ?
or it is a myfaces extension?
I can't find any documentation about that.
Thanks for any help.
On 10/29/06, Gerald Müllan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> this is because the value is not posted back to server and it is
> ignored by the browser when submiting the form.
>
> But you can use t:inputText in combination with the attribute
> "disabledOnClientSide" which should be set to true.
>
> This makes sure that the value will be pushed to the form.
>
> regards,
>
> Gerald
>
> On 10/29/06, ken carlino <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I have page using inputText in myfaces. It works okay. But when I
try
> > to mark the username field to either 'readonly' or 'disabled' equals
> > to 'true'.
> >
> > Like this:
> > <h:inputText value="#{userForm.user.username}" id="username"
> > required="true" styleClass="text large" readonly="true">
> > <v:commonsValidator type="required"
arg="#{text['user.username']}"/>
> > </h:inputText>
> >
> > the input field of the page in browser is not-changeable (as
> > expected). But when i try to do a submit my form, I get this
> > error message 'This username (null) or e-mail address (null) already
> > exists. Please try a different username.'
> >
> >
> > Can you please tell why the username becomes 'null' when I try to
> > submit? If i remove the 'readonly='true'' the submit works (i.e. the
> > username is not null).