ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sascha Rodekamp <sascha.rodekamp.lynx...@googlemail.com>
Subject Re: jQuery validator defaults
Date Wed, 13 Jul 2011 05:52:47 GMT
Hi Jonatan,
you can't put label tags in js files, because they are interpreted by the
freemarker parser, which don't parse js files.

Some month ago, i created a JS function which can resolve ui Label tags. You
can find it in the selectall.js
There are two functions, one which takes an JSON array with ui label
information and one which only takes a resource and one label.

 * Reads the requiered uiLabels from the uiLabelXml Files
 * @param requiredLabels JSON Object {resource : [label1, label2 ...],
resource2 : [label1, label2, ...]}
 * @return JSON Object
function getJSONuiLabels(requiredLabels) {

 * Read the requiered uiLabel from the uiLabelXml Resource
 * @param uiResource String
 * @param errUiLabel String
 * @returns String with Label
function getJSONuiLabel(uiResource, errUiLabel) {

Hope that helps.

Have a good day

2011/7/12 Jonatan Soto <seniledementia@gmail.com>

> Hi all,
> I want to use the uiLabelMap variable in a .js I've created in order to set
> the defaults of any sort for jQuery plugins like validator. To do that I
> just included this in the main-decorator (CommonScreens.xml):
> <set field="layoutSettings.javaScripts[]" value="/images/defaults.js"
> global="true"/>
> In this file I put the code like that:
> jQuery.extend(jQuery.validator.messages, {
>  required: '${uiLabelMap.EcommerceRequired}'
> });
> Of course, this is not properly rendered, so the question is: Would you put
> all the javascript code in the header.ftl for example?
> Thanks in advance.
> Regards,
> Jonatan Soto


Sascha Rodekamp
    Visit the new german OFBiz Blog: http://www.ofbiz.biz
    Lynx-Consulting GmbH
    Johanniskirchplatz 6
    D-33615 Bielefeld

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message