Feb 24, 2017 3:59 AM
19 Posts

csjs calling ssjs - script library

  • Category: Other
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags: csjs,ssjs,library
  • Replies: 1

I have a client-side script in which I initiate some SSJS to collect string values that reside in a strings.properties file:

function confirmBeforeDelete(){
    var msgEmptySelection = "#{javascript:strings['empty']}";
    var msgConfirm = "#{javascript:strings['confirm']}";

    if(!XSP.isViewPanelRowSelected("#{id:vwPnlDefault}", "col1")) {
        !XSP.alert(msgEmptySelection);
        return false;
    }

    if(!XSP.confirm(msgConfirm)) {return false;}    
}

This works fine.

But when I store the script in a csjs library my text messages becomes: #{javascript:strings['empty']} and #{javascript:strings['confirm']}.

What am I doing wrong?

Apr 4, 2017 4:28 PM
94 Posts
yep, can't do that

I tried the same thing... the id's are generated when the page loads, but code in the script library does not get executed.  So, one way around it is to calculate the id's in the page and then pass those id's as parameters of the function in the script library.