SSJS之后的客户端消息例程如何?

发布于 2024-12-29 02:07:34 字数 161 浏览 3 评论 0原文

我有一个在 SSJS 中发送和发送电子邮件的按钮...

现在我想如果可以向用户实时显示发送电子邮件的状态:

  1. 发送过程....
  2. 发送成功或发送错误

我如何调用来自 SSJS 例程的 JS 客户端代码? 你有什么建议吗?

I have a Button that in SSJS send and Email...

Now I would if is possibile show the status of sending of email in real-time to the user:

  1. sending process....
  2. sending Successful or sending error

How Can i call a JS client codice from SSJS routine?
Have you any suggest?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

月下凄凉 2025-01-05 02:07:34

如果您使用 ExtLib,那么您还可以使用 @WarningMessage('messageText') 方法。

您需要向 XPage 添加一个部分来显示消息。它可以很简单,

<xp:messages id="messages1"></xp:messages>

一旦添加,每次调用 @WarningMessage 都会在消息窗格中添加一行。

If you are using ExtLib then you can also use the @WarningMessage('messageText') method.

You will need to add a section to the XPage to display the messages. It can be as simple as

<xp:messages id="messages1"></xp:messages>

Once added each call to @WarningMessage will add a line to the messages pane.

衣神在巴黎 2025-01-05 02:07:34

8.5.3 引入了一个非常好的方法:

view.postScript

您可以从 SSJS 代码中插入任何您喜欢的 CSJS 代码。

8.5.3 introduced a very nice approach:

view.postScript

you may insert any CSJS code you like from the SSJS code.

瞄了个咪的 2025-01-05 02:07:34

这非常简单。
1. 在页面上添加隐藏输入控件,并记下 id。
2.在你的SSJS中使用 getComponent("inputHidden1").setValue("This is the message")
3. 确保隐藏输入控件位于正在刷新的区域中(否则该值不会传回浏览器,因此无法在 CSJS 中访问)
4. 转到“源”窗格并将光标放在触发 SSJS 的事件处理程序上或其中。您需要执行此操作才能到达 onComplete 事件
5. 在“所有属性”面板中转到 onComplete,在那里添加您的 CSJS。例如alert(dojo.byId("#{id:inputHidden1}").value)

这将运行您的SSJS,并在完成后用字段中的任何代码提醒用户。

有关演示和演示代码,请查看我的博客文章: http://www.intec.co.uk/xpages-calling-client-side-javascript-from-server-side-javascript/

This is quite straightforward.
1. Add a Hidden Input control on your page, noting the id.
2. In your SSJS use getComponent("inputHidden1").setValue("This is the message")
3. Ensure the Hidden Input control is in the area being refreshed (otherwise the value doesn't get passed back to the browser, so can't be accessed in CSJS)
4. Go to the Source pane and place the cursor on or in the eventHandler that is triggering your SSJS. You need to do this to get to the onComplete event
5. In All Properties panel go to onComplete, add your CSJS there. e.g. alert(dojo.byId("#{id:inputHidden1}").value)

This will run your SSJS and on completion alert the user with whatever code is in the field.

For a demo and demo code, check out my blog post: http://www.intec.co.uk/xpages-calling-client-side-javascript-from-server-side-javascript/

肤浅与狂妄 2025-01-05 02:07:34

除了 Paul 的答案之外,另一种方法是使用 extlib 中的对话框,您可以从 ssjs 调用它,在对话框中放置一个字段并将其设置为范围值并显示对话框。

Another way to do it besides Pauls answer is to use a dialog from the extlib, and you can call it from ssjs, put a field in a dialog and set it to a scope value and show the dialog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文