Skip to main content link. Accesskey S

XPages Wiki

Submit Search

YouAtNotes XPages Wiki


Page12

By Tag: javascript

How to output custom content like print from an agent

Julian Buss | May 14, 2009 9:05:53 PM | Tags:code, javascript, agent

You can use server side javascript in a XPage to write custom content to the browser, just like with agents and "print" statements in classic web development. This tip is taken from Stephan Wissel from [[http://www.wissel.net/blog/d6plinks/SHWL-7MGFBN]]. - create a Xpage - set the "rendered" ...

How to use object oriented server side javascript

Julian Buss | January 6, 2010 1:53:35 PM | Tags:javascript

This is a short howto for people who know how to code object oriented in other languages. ==Create a class== {code:} function myClass(param1, param2) { var private_member1 = param1; var private_member2 = param2; this.method1 = function () { // do something this.method2 = function(param1, ...

Useful formulas and code snippets

Julian Buss | April 6, 2009 12:03:33 PM | Tags:code, formula, javascript

Here are some various snippets. ==Get the current username== Use {code:}session.getEffectiveUserName(){code} to the the name of the user who is logged on. Use @Name() to convert it for exampel to a CN name: {code:} @Name("[CN]", session.getEffectiveUserName()) {code} ==Check if a user contains a ...

Work with Client side JavaScript

Julian Buss | April 6, 2009 1:33:07 PM | Tags:code, javascript, client

==Use the result of a server side script in the client== For example, use the result of a @DbName in your client script: {code:} dbname='#{javascript:@DbName()}'; {code} ==Get the runtime id of a control== In the XPage you set a name / id for a control, for example "panelSidebar". But at runtime, ...

Work with datasources

Julian Buss | August 19, 2009 9:48:06 AM | Tags:code, javascript, variables

==Where to define a datasource== You can define a datasource on different levels: * in the XPage properties * in the properties of a custom component * in the properties of a panel Use the folowing rule of thumb: If you need a datasource in your whole XPage and even in custom components which are ...

Work with documents and fields on the XPage

Julian Buss | April 6, 2009 1:12:07 PM | Tags:code, javascript

==Get and set a field on the XPage== ===Server JS=== {code:} getComponent("elementName").getValue(); getComponent("elementName").setValue("something"); {code} Note: you cannot access or set fields with visible=false. If you want to work with a field, but don't want to display it, give the field a ...

Work with events and partial or full refresh

Julian Buss | September 11, 2009 8:27:22 AM | Tags:code, javascript

==Run a partial update from client javascript== You can use the following function to trigger a partial update from client javascript {code:} XSP.partialRefreshPost(id); {code} "id" is the runtime ID of the control, that means you have to get it with "#{id:nameOfControl}". If you don't need to be ...

Work with numbers / math

Julian Buss | July 30, 2009 10:46:16 AM | Tags:code, javascript

==Convert a string to a number== {code:} var s = new Number(n) {code} ==Round to n decimals== You can round a number with {code:} Math.round(number) {code} Rounding to for example 3 decimals: {code:} Math.round(number * 1000) / 1000 {code} ==Integer division== {code:} Math.floor(number / 2) {code} ...

Work with validation

Julian Buss | April 6, 2009 1:48:26 PM | Tags:UI, validation, code, javascript

==Use your own validation tests== Create a Expression Validator and use JavaScript for comparing stuff. The value of the fields is stored in the variable "value". {code:} value == sessionScope.get("comparevalue"); {code} Here the validator is true if the value of the fields is the same than the ...

Work with views

Julian Buss | April 6, 2009 12:12:05 PM | Tags:code, javascript, view, search

==DbColumn and DbLookup with result as guaranteed array and with a cache== @DbLookup has the issue that it returns a string when it found exactly one result, and an array when it found multiple results. That means after each @DbLookup you have to check if your result is a string or an array if you ...

Page12
Use  searchlotus.com  for news in the Web related to Lotus Notes and Domino,
and to search those sites.
Check  youatnotes.com  for great Lotus Notes, Domino and XPages software.
Did this wiki help you?
Did this saved you time? Express your gratitude by making a donation:
PayPal - The safer, easier way to pay online!