0

I created a javascript function : Time.js :

  var now = new moment();
console.log(now.format("HH:mm:ss"));

And now I would want to add it on my custom control to see if it works. How to appeal this function/library? Should it be as a default value for a computed field?

Thanks for your attention!

  • What I need exactly is a function for a continuos time & date. In Lotus Notes Client i made it by creating a function helped by the JSHeader but in Xpages I don't know how, many thanks.
1
  • If you've found a solution that works, please create it as answer to your own question, so others can use your code as well. Commented Apr 3, 2014 at 13:52

1 Answer 1

1

If you simply want to display the current time in a text field, you can use the @Now "at function" as below, with a converter:

<xp:text escape="true" id="computedField1" value="#{javascript:@Now()}">
    <xp:this.converter>
        <xp:convertDateTime type="time"></xp:convertDateTime>
    </xp:this.converter>
</xp:text>

When you say "continuous time & date" though, do you mean you want it to continuously update?

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your response, Brian. Yes, a continously update, I did found many examples. Unfortunately, now I'm trying to correct this error from the Source design: "the prefix xs for element xp scriptblock is not bound" after I used scriptBlock
Well that's an unrecognised prefix. At the top of your xpage you could have the following prefixes defined: <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom" xmlns:xe="http://www.ibm.com/xsp/coreex">. In each case the xp, xc & xe are user defined. In this example, xp is for the core xpages controls, xc for custom controls in your app and xe for controls form the extension library. The xs you refer to must have been a user defined prefix from the example you found, for example xmlns:xs="http://www.ibm.com/xsp/custom"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.