You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Gordon <ma...@mcgordon.com> on 2001/09/29 02:21:56 UTC
localization of onblur
Hello,
I am new to struts and loving it. Thanks to all involved.
My question relates to localization of java script. How would go you
about getting the "ENTER THE CODE" noted below to come from the resource
file?
Thanks in advance.
-Mark
PS I hope this isn't a stupid question.
<html:form action="/te/location" focus="code" method="get">
<table border="0" width="100%">
<tr>
<th align="right" class="formLabel">
<bean:message key="location.prompt.code"/>
</th>
<td align="left" class="formField">
<html:text property="code" size="6" maxlength="6"
onblur="window.status=('ENTER THE CODE')" styleClass="formField"/>
</td>
</tr>
Re: localization of onblur
Posted by Adam Grohs <as...@hotmail.com>.
Mark,
This certainly does not seem like an optimal solution as it may require
some manual effort in the JS to duplicate some stuff from the appResources
file, but something like this should work, or you could get more complex and
add you own custom attribute to the taglib, or you could create a JS array
from the appResources file with the values you need for that page and pass
those in to a JS function:
<script language="JavaScript">
function statusLocal(someKey){
if (someKey=="ENTER THE CODE"){
window.status=("<bean:message key="your.key"/>")
}
}
</script>
<html:text property="code" size="6" maxlength="6" onblur="statusLocal('ENTER
THE CODE')" styleClass="formField"/>
Hope this helps,
Adam S. Grohs
agrohs@ixl.com
----- Original Message -----
From: "Mark Gordon" <ma...@mcgordon.com>
To: <st...@jakarta.apache.org>
Sent: Friday, September 28, 2001 7:21 PM
Subject: localization of onblur
>
> Hello,
>
> I am new to struts and loving it. Thanks to all involved.
>
> My question relates to localization of java script. How would go you
> about getting the "ENTER THE CODE" noted below to come from the resource
> file?
>
> Thanks in advance.
>
> -Mark
>
> PS I hope this isn't a stupid question.
>
>
> <html:form action="/te/location" focus="code" method="get">
> <table border="0" width="100%">
>
> <tr>
> <th align="right" class="formLabel">
> <bean:message key="location.prompt.code"/>
> </th>
> <td align="left" class="formField">
> <html:text property="code" size="6" maxlength="6"
> onblur="window.status=('ENTER THE CODE')" styleClass="formField"/>
> </td>
> </tr>
>
>
Re: localization of onblur
Posted by ma...@tumbleweed.com.
No, it's not a stupid question. :-)
Unfortunately, I don't know of a good answer, either. The best I've been
able to come up with in a similar situation is resorting to an HTML tag so
that I can use a <bean:message> inside it. In your case, this would look
something like:
<input type="text"
onblur="window.status=('<bean:message key="your.key"/>')"
...>
This is pretty nasty, and doesn't allow you to make use of the Struts HTML
taglib properly. I'm hoping that we can improve this situation somewhat in
Struts 1.1.
--
Martin Cooper
----- Original Message -----
From: "Mark Gordon" <ma...@mcgordon.com>
To: <st...@jakarta.apache.org>
Sent: Friday, September 28, 2001 5:21 PM
Subject: localization of onblur
>
> Hello,
>
> I am new to struts and loving it. Thanks to all involved.
>
> My question relates to localization of java script. How would go you
> about getting the "ENTER THE CODE" noted below to come from the resource
> file?
>
> Thanks in advance.
>
> -Mark
>
> PS I hope this isn't a stupid question.
>
>
> <html:form action="/te/location" focus="code" method="get">
> <table border="0" width="100%">
>
> <tr>
> <th align="right" class="formLabel">
> <bean:message key="location.prompt.code"/>
> </th>
> <td align="left" class="formField">
> <html:text property="code" size="6" maxlength="6"
> onblur="window.status=('ENTER THE CODE')" styleClass="formField"/>
> </td>
> </tr>
>