In an ftl file we can access a property/xml file value as follows
${uiLabelMap.CommonFollowingErrorsOccurred} Is there a way to do something similar in a javascript function? In a separate thread Rishi pointed me to [0], but that only does a show/hide of a div that already has a message. I am doing this function showAjaxError(data) { var errorMessageList = data['errorMessageList']; if (errorMessageList != null){ var buffer = ['The Following Errors Occurred:']; for ( var i = 0; i < errorMessageList.size(); i ++){ buffer.push(errorMessageList[i]); } var errorDiv = dojo.query('.ajaxErrorBox'); errorDiv[0].innerHTML = buffer.join("<br/>"); errorDiv.style('display', 'block'); } else { var errorDiv = dojo.query('.ajaxErrorBox'); errorDiv.style('display', 'none'); } } I wanted to replace the hard coded value of "The Following Errors Occurred:" with the ${uiLabelMap.CommonFollowingErrorsOccurred} from messages.ftl. Not sure how I could ever get that value since I realize its on the server side of things and I want the value in the client side javascript. [0]https://demo.ofbiz.org/accounting/control/CostCenters |
You will have to pass all localized text to the JavaScript function. For
an example, check out how the expand/collapse links are done. -Adrian Stephen Rufle wrote: > In an ftl file we can access a property/xml file value as follows > ${uiLabelMap.CommonFollowingErrorsOccurred} > > Is there a way to do something similar in a javascript function? In a > separate thread Rishi pointed me to [0], but that only does a show/hide > of a div that already has a message. > > I am doing this > > function showAjaxError(data) { > var errorMessageList = data['errorMessageList']; > if (errorMessageList != null){ > var buffer = ['The Following Errors Occurred:']; > for ( var i = 0; i < errorMessageList.size(); i ++){ > buffer.push(errorMessageList[i]); > } > var errorDiv = dojo.query('.ajaxErrorBox'); > errorDiv[0].innerHTML = buffer.join("<br/>"); > errorDiv.style('display', 'block'); > } > else > { > var errorDiv = dojo.query('.ajaxErrorBox'); > errorDiv.style('display', 'none'); > } > } > > I wanted to replace the hard coded value of "The Following Errors > Occurred:" with the ${uiLabelMap.CommonFollowingErrorsOccurred} from > messages.ftl. Not sure how I could ever get that value since I realize > its on the server side of things and I want the value in the client side > javascript. > > [0]https://demo.ofbiz.org/accounting/control/CostCenters > |
Are the expand/collapse links you are talking about the ones on?
https://demo.ofbiz.org/catalog/control/EditProduct?productId=WG-9943 Adrian Crum wrote: > You will have to pass all localized text to the JavaScript function. > For an example, check out how the expand/collapse links are done. > > -Adrian > > Stephen Rufle wrote: >> In an ftl file we can access a property/xml file value as follows >> ${uiLabelMap.CommonFollowingErrorsOccurred} >> >> Is there a way to do something similar in a javascript function? In a >> separate thread Rishi pointed me to [0], but that only does a >> show/hide of a div that already has a message. >> >> I am doing this >> >> function showAjaxError(data) { >> var errorMessageList = data['errorMessageList']; >> if (errorMessageList != null){ >> var buffer = ['The Following Errors Occurred:']; >> for ( var i = 0; i < errorMessageList.size(); i ++){ >> buffer.push(errorMessageList[i]); >> } >> var errorDiv = dojo.query('.ajaxErrorBox'); >> errorDiv[0].innerHTML = buffer.join("<br/>"); >> errorDiv.style('display', 'block'); >> } >> else >> { >> var errorDiv = dojo.query('.ajaxErrorBox'); >> errorDiv.style('display', 'none'); >> } >> } >> >> I wanted to replace the hard coded value of "The Following Errors >> Occurred:" with the ${uiLabelMap.CommonFollowingErrorsOccurred} from >> messages.ftl. Not sure how I could ever get that value since I >> realize its on the server side of things and I want the value in the >> client side javascript. >> >> [0]https://demo.ofbiz.org/accounting/control/CostCenters >> > > -- Stephen P Rufle [hidden email] H1:480-626-8022 H2:480-802-7173 Yahoo IM: stephen_rufle AOL IM: stephen1rufle |
Yes.
-Adrian Stephen Rufle wrote: > Are the expand/collapse links you are talking about the ones on? > https://demo.ofbiz.org/catalog/control/EditProduct?productId=WG-9943 > > Adrian Crum wrote: >> You will have to pass all localized text to the JavaScript function. >> For an example, check out how the expand/collapse links are done. >> >> -Adrian >> >> Stephen Rufle wrote: >>> In an ftl file we can access a property/xml file value as follows >>> ${uiLabelMap.CommonFollowingErrorsOccurred} >>> >>> Is there a way to do something similar in a javascript function? In a >>> separate thread Rishi pointed me to [0], but that only does a >>> show/hide of a div that already has a message. >>> >>> I am doing this >>> >>> function showAjaxError(data) { >>> var errorMessageList = data['errorMessageList']; >>> if (errorMessageList != null){ >>> var buffer = ['The Following Errors Occurred:']; >>> for ( var i = 0; i < errorMessageList.size(); i ++){ >>> buffer.push(errorMessageList[i]); >>> } >>> var errorDiv = dojo.query('.ajaxErrorBox'); >>> errorDiv[0].innerHTML = buffer.join("<br/>"); >>> errorDiv.style('display', 'block'); >>> } >>> else >>> { >>> var errorDiv = dojo.query('.ajaxErrorBox'); >>> errorDiv.style('display', 'none'); >>> } >>> } >>> >>> I wanted to replace the hard coded value of "The Following Errors >>> Occurred:" with the ${uiLabelMap.CommonFollowingErrorsOccurred} from >>> messages.ftl. Not sure how I could ever get that value since I >>> realize its on the server side of things and I want the value in the >>> client side javascript. >>> >>> [0]https://demo.ofbiz.org/accounting/control/CostCenters >>> >> >> > |
Free forum by Nabble | Edit this page |