VladP
VladP

Reputation: 901

xPages execute SSJS from CSJS

I want to run SSJS from CSJS script library... This command works fine in Client Side JavaScript library:

var myVar = "#{javascript:getComponent('myCustomControl').getPropertyMap().property1 = 'test'}";

When I check custom control property1 from SSJS it shows test. So works fine. But I need to substitute 'test' value with some variable, like:

function myFunction(testID){
     var myVar = "#{javascript:getComponent('myCustomControl').getPropertyMap().property1 = '" + testID + "'}";
}

Now when I check customcontrol property1 property it says exactly

'" + testID + "'

so it doesn't calculate/substitute

Upvotes: 0

Views: 1719

Answers (3)

David Navarre
David Navarre

Reputation: 1022

Syntax error.

You have the double-quotes enclosed in single quotes when setting the value.

'" + testID + "'

If you need the value of testID in quotes, use

'"' + testID + '"'

If you just need the value of testID just use

testID

Amiright?

Upvotes: 0

John Vincent Jardin
John Vincent Jardin

Reputation: 284

I created a video tutorial on how to run SSJS from Client Side JavaScript using Remote Services. It's extremely powerful and allows you to pass parameters and return various objects back to CSJS for processing.

Click here to watch this video tutorial on NotesIn9.com

Upvotes: 4

Thomas Adrian
Thomas Adrian

Reputation: 3636

You can't run SSJS from a client side JavaScript library

Upvotes: 0

Related Questions