You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stephen Friedrich <tr...@eekboom.com> on 2007/08/14 00:38:08 UTC

[Trinidad] Why can't I use id="name"? Javascript error!

When I used this
    <tr:inputText id="name" label="Name" value="#{department.name}" required="true"/>
my form did not submit at all. I finally noticed a Javascript error
"a0.split is not a function"

Firebug showed the error in Common1_2_1.js in this function
function _getJavascriptId(a0)
{
   return a0.split(':').join('_');
}

As soon as I changed the id attribute of inputText to "name2" it started to work.
Unfortunately this breaks the validation of the field, because Seam requires the id
attribute to be the same as the EL property for hibernate validation to work.
So I have to change my db entity to avoid a javascript error?!

Re: [Trinidad] EL not processed for label attribute for server-side validation

Posted by Adam Winer <aw...@gmail.com>.
This should already be happening...  Could
we get a JIRA issue?

-- Adam


On 8/14/07, Todd Engle <To...@trisyngroup.com> wrote:
>
>  Trinidad releases 1.01 and 1.02 allow client-side validation to be
> disabled and server-side only validation to occur.  However, for
> server-side validation of required fields, an EL expression in the label
> atrribute is not processed, and the generated error message will not
> contain the label text.  If the label attribute contains static text
> (e.g. label="Date:"), the label is included in the error message.
>
> Example:
>
>    <f:loadBundle basename="ResourceBundle" var="labels" />
>
>    <tr:inputText label="#{labels.date}" value="#{bean.dateField}"
> required="true" />
>
> When an empty (but required) field is submitted, the generated error
> message is: " - Value Required"
>
> If the label attribute contains "Date:", the generated message is:
> "Date: - Value Required"
>
> Can Trinidad be configured to process EL expressions for server-side
> validation?
>

Re: [Trinidad] EL not processed for label attribute for server-side validation

Posted by Simon Lessard <si...@gmail.com>.
True. Maybe tr:messages was placed before the f:loadBundle in the page?

On 8/14/07, Adam Winer <aw...@gmail.com> wrote:
>
> I'm sure it is the issue...  but there's already plenty of code
> in UIXEditableValue and the Trinidad MessageFactory
> class to handle this by delaying execution of the ValueBinding
> until the last possible moment.  Something's gone wrong with
> that code.
>
> -- Adam
>
>
>
> On 8/14/07, Simon Lessard <si...@gmail.com> wrote:
> > Hello Todd,
> >
> > Have you tried using a standard managed bean instead of f:loadBundle by
> any
> > chance? I'm trying to figure if that can be the source of the problem.
> >
> >
> > Regards,
> >
> > ~ Simon
> >
> > p.s. If that message is sent twice to the list please send me a private
> > email telling me so. I got some DNS problems today saying that mails are
> not
> > delivered every now and then, but I'm paranoid and always dislike to
> spam
> > mailing lists with double posts.
> >
> > On 8/14/07, Todd Engle <To...@trisyngroup.com> wrote:
> > >
> > > Trinidad releases 1.01 and 1.02 allow client-side validation to be
> > > disabled and server-side only validation to occur.  However, for
> > > server-side validation of required fields, an EL expression in the
> label
> > > atrribute is not processed, and the generated error message will not
> > > contain the label text.  If the label attribute contains static text
> > > (e.g. label="Date:"), the label is included in the error message.
> > >
> > > Example:
> > >
> > >    <f:loadBundle basename="ResourceBundle" var="labels" />
> > >
> > >    <tr:inputText label="#{labels.date}" value="#{bean.dateField}"
> > > required="true" />
> > >
> > > When an empty (but required) field is submitted, the generated error
> > > message is: " - Value Required"
> > >
> > > If the label attribute contains "Date:", the generated message is:
> > > "Date: - Value Required"
> > >
> > > Can Trinidad be configured to process EL expressions for server-side
> > > validation?
> > >
> >
> >
>

Re: [Trinidad] EL not processed for label attribute for server-side validation

Posted by Adam Winer <aw...@gmail.com>.
I'm sure it is the issue...  but there's already plenty of code
in UIXEditableValue and the Trinidad MessageFactory
class to handle this by delaying execution of the ValueBinding
until the last possible moment.  Something's gone wrong with
that code.

-- Adam



On 8/14/07, Simon Lessard <si...@gmail.com> wrote:
> Hello Todd,
>
> Have you tried using a standard managed bean instead of f:loadBundle by any
> chance? I'm trying to figure if that can be the source of the problem.
>
>
> Regards,
>
> ~ Simon
>
> p.s. If that message is sent twice to the list please send me a private
> email telling me so. I got some DNS problems today saying that mails are not
> delivered every now and then, but I'm paranoid and always dislike to spam
> mailing lists with double posts.
>
> On 8/14/07, Todd Engle <To...@trisyngroup.com> wrote:
> >
> > Trinidad releases 1.01 and 1.02 allow client-side validation to be
> > disabled and server-side only validation to occur.  However, for
> > server-side validation of required fields, an EL expression in the label
> > atrribute is not processed, and the generated error message will not
> > contain the label text.  If the label attribute contains static text
> > (e.g. label="Date:"), the label is included in the error message.
> >
> > Example:
> >
> >    <f:loadBundle basename="ResourceBundle" var="labels" />
> >
> >    <tr:inputText label="#{labels.date}" value="#{bean.dateField}"
> > required="true" />
> >
> > When an empty (but required) field is submitted, the generated error
> > message is: " - Value Required"
> >
> > If the label attribute contains "Date:", the generated message is:
> > "Date: - Value Required"
> >
> > Can Trinidad be configured to process EL expressions for server-side
> > validation?
> >
>
>

RE: [Trinidad] EL not processed for label attribute for server-side validation

Posted by Todd Engle <To...@trisyngroup.com>.
Thanks Simon -- a managed bean approach worked.  I found your posting
here and that helped explain the reason for the problem (and also the
solution):
 
http://www.nabble.com/-Trinidad--setActionListener-and-resource-bundle-t
4224032.html
 

________________________________

From: Simon Lessard [mailto:simon.lessard.3@gmail.com] 
Sent: Tuesday, August 14, 2007 1:55 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] EL not processed for label attribute for
server-side validation


Hello Todd,

Have you tried using a standard managed bean instead of f:loadBundle by
any chance? I'm trying to figure if that can be the source of the
problem.


Regards,

~ Simon

p.s. If that message is sent twice to the list please send me a private
email telling me so. I got some DNS problems today saying that mails are
not delivered every now and then, but I'm paranoid and always dislike to
spam mailing lists with double posts. 


On 8/14/07, Todd Engle <To...@trisyngroup.com> wrote: 


	Trinidad releases 1.01 and 1.02 allow client-side validation to
be
	disabled and server-side only validation to occur.  However, for
	server-side validation of required fields, an EL expression in
the label
	atrribute is not processed, and the generated error message will
not 
	contain the label text.  If the label attribute contains static
text
	(e.g. label="Date:"), the label is included in the error
message.
	
	Example:
	
	   <f:loadBundle basename="ResourceBundle" var="labels" /> 
	
	   <tr:inputText label="#{labels.date}"
value="#{bean.dateField}"
	required="true" />
	
	When an empty (but required) field is submitted, the generated
error
	message is: " - Value Required" 
	
	If the label attribute contains "Date:", the generated message
is:
	"Date: - Value Required"
	
	Can Trinidad be configured to process EL expressions for
server-side
	validation?
	



Re: [Trinidad] EL not processed for label attribute for server-side validation

Posted by Simon Lessard <si...@gmail.com>.
Hello Todd,

Have you tried using a standard managed bean instead of f:loadBundle by any
chance? I'm trying to figure if that can be the source of the problem.


Regards,

~ Simon

p.s. If that message is sent twice to the list please send me a private
email telling me so. I got some DNS problems today saying that mails are not
delivered every now and then, but I'm paranoid and always dislike to spam
mailing lists with double posts.

On 8/14/07, Todd Engle <To...@trisyngroup.com> wrote:
>
>
> Trinidad releases 1.01 and 1.02 allow client-side validation to be
> disabled and server-side only validation to occur.  However, for
> server-side validation of required fields, an EL expression in the label
> atrribute is not processed, and the generated error message will not
> contain the label text.  If the label attribute contains static text
> (e.g. label="Date:"), the label is included in the error message.
>
> Example:
>
>    <f:loadBundle basename="ResourceBundle" var="labels" />
>
>    <tr:inputText label="#{labels.date}" value="#{bean.dateField}"
> required="true" />
>
> When an empty (but required) field is submitted, the generated error
> message is: " - Value Required"
>
> If the label attribute contains "Date:", the generated message is:
> "Date: - Value Required"
>
> Can Trinidad be configured to process EL expressions for server-side
> validation?
>

[Trinidad] EL not processed for label attribute for server-side validation

Posted by Todd Engle <To...@trisyngroup.com>.
 Trinidad releases 1.01 and 1.02 allow client-side validation to be
disabled and server-side only validation to occur.  However, for
server-side validation of required fields, an EL expression in the label
atrribute is not processed, and the generated error message will not
contain the label text.  If the label attribute contains static text
(e.g. label="Date:"), the label is included in the error message.

Example:

   <f:loadBundle basename="ResourceBundle" var="labels" />

   <tr:inputText label="#{labels.date}" value="#{bean.dateField}"
required="true" />

When an empty (but required) field is submitted, the generated error
message is: " - Value Required"

If the label attribute contains "Date:", the generated message is:
"Date: - Value Required"

Can Trinidad be configured to process EL expressions for server-side
validation?

Re: [Trinidad] Why can't I use id="name"? Javascript error!

Posted by Adam Winer <aw...@gmail.com>.
The simplest "fix" is switching tr:form to h:form.  That'll force
a naming container into your page, changing "name"
to "formsId:name".  Or, wrap the page in an f:subview to
again force clientId prefixing.  (I'm assuming Seam only
cares about the ID, not the clientId).

Yes, it's a big annoyance.  It comes from the fact that
form.foo gives you the "foo" element in a form.  And form.name
is supposed to give you the name of the form, but if you have
an element named "name", it blocks that.

-- Adam


On 8/13/07, Stephen Friedrich <tr...@eekboom.com> wrote:
> When I used this
>     <tr:inputText id="name" label="Name" value="#{department.name}" required="true"/>
> my form did not submit at all. I finally noticed a Javascript error
> "a0.split is not a function"
>
> Firebug showed the error in Common1_2_1.js in this function
> function _getJavascriptId(a0)
> {
>    return a0.split(':').join('_');
> }
>
> As soon as I changed the id attribute of inputText to "name2" it started to work.
> Unfortunately this breaks the validation of the field, because Seam requires the id
> attribute to be the same as the EL property for hibernate validation to work.
> So I have to change my db entity to avoid a javascript error?!
>