Here, PeopleCode sets the logic that determines when the JavaScript code will run.

This is not as simple as dropping a HTML Area on your page and setting the script in PeopleCode. This is because the value in the HTML Area field remains and the JavaScript code will keep executing at subsequent page refreshes.

Steps:

Lets have a derived/work record TEST_WRK And field HTMLAREA (TEST_WRK – HTMLAREA).

1. Create a HTML definition as your javascript template. Include all the necessary user-defined javascript functions that you need. Eg Html Definition is TESTJS

<input type="hidden" name="USERJSINJECTION" value=""/>
<script type="text/javascript">
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}

function user_function1() {
window.open("","toolbar = no");
}
function user_function2() {
alert('Hello from user javascript');
}

addLoadEvent(function() {
%bind(:1)
});
</script>

2. At the scroll level 0 of your PS page, insert a HTML Area control. Assign this to the TEST_WRK.HTMLAREA field.

3. Again at scroll level 0 of your page, insert an editbox and assign this again to TEST_WRK.HTMLAREA. And Set the Following Field Property

a. On the Use tab, check Invisible and Modifiable by JavaScript.

b. On the General tab, set Page Field Name to USERJSINJECTION.

4. Now in PeopleCode, to execute your javascript function.

GetLevel0()(1).TEST_WRK.HTMLAREA.Value = GetHTMLText(HTML.TESTJS, "user_function1()");

Run JavaScript on your PeopleSoft pages conditionally的更多相关文章

  1. SharePoint JavaScript API in application pages

    前言 最近,在SharePoint 应用程序页中写JavaScript API,进行一些数据交互.其实,很简单的事情却遇到了问题,记录一下,希望能对遇到类似问题的人以帮助. 引用JavaScript ...

  2. ASP.NET postback with JavaScript (UseSubmitBehavior)

    ASP.NET postback with JavaScript Here is a complete solution Entire form tag of the asp.net page < ...

  3. .net 开源 JavaScript 解析引擎

    1. Javascript .NET 地址为:http://javascriptdotnet.codeplex.com/ 使用方法: Quick Start This section provides ...

  4. Dynamic Prompt Table for Record Field on PeopleSoft Page

    Sometimes a situation in project work arises to have a dynamic prompt table for record fields on Peo ...

  5. Creating Help Pages for ASP.NET Web API -摘自网络

    When you create a web API, it is often useful to create a help page, so that other developers will k ...

  6. JavaScript 模块化历程

    这是一篇关于js模块化历程的长长的流水账,记录js模块化思想的诞生与变迁,展望ES6模块化标准的未来.经历过这段历史的人或许会感到沧桑,没经历过的人也应该知道这段历史. 无模块时代 在ajax还未提出 ...

  7. 2018年你需要知道的13个JavaScript工具库

    译者按: 你可能已经用到Underscore或者Lodash.本文列举了13个常用的JavaScript工具库来提高开发效率. 原文: 11 Javascript Utility Libraries ...

  8. JavaScript 第一章总结

    A quick dip into javascipt The way JavaScript works HTML 用一系列的 markup 来呈现整个 content 的 structure.CSS ...

  9. Java,JavaScript,jQuery,jSP,js

    js是javascript文件的文件后缀,就像 a.txt 这个.txt是后缀一样 jsp是jsp网页文件的后缀,而jsp是java web 的表现层的一种技术 jquery 是一个函数库,基于jav ...

随机推荐

  1. CentOS7 安装Redis 3.2.3

    $ wget http://download.redis.io/releases/redis-3.2.3.tar.gz $ tar xzf redis-3.2.3.tar.gz $ cd redis- ...

  2. NAND flash cache编程

    PROGRAM PAGE CACHE MODE 0x80-0x15: CACHE编程实际上是标准的页编程命令的带缓冲编程模式,编程开始是发布SERIAL DATA INPUT(0x80)命令,随后是5 ...

  3. 在备份和导入mysql数据库遇到的几个问题

    一.怎么导出和备份 1.普通方法,运用工具或者命令直接导出sql脚本,以navicat为例,直接选中数据库,转储sql文件 问题:当有视图或者函数执行失败时不好处理 2.视图函数和表数据分开导出 以n ...

  4. VisualVM连接远程Java进程

    jstatd是一个RMI(Remove Method Invocation)的server应用,用于监控jvm的创建和结束,并且提供接口让监控工具(如VisualVM)可以远程连接到本机的jvms . ...

  5. SQLite打开提示database disk image is malformed

    SQLite打开提示database disk image is malformed 网上说产生这种错误的原因有很多种,磁盘空间不足,还有就是写入数据过程中突然掉电等. 这种情况,如果数据还可以导出, ...

  6. C++primer 练习15.15

    // 15_15.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #include< ...

  7. [Uva 10085] The most distant state (BFS)

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  8. [HDU 4585] Shaolin (map应用)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4585 题目大意:不停的插入数字,问你跟他相距近的ID号.如果有两个距离相近的话选择小的那个. 用map ...

  9. (DP)MaxSubArr

    public static int MSA(int[] ar) { int[] arr = new int[ar.length]; int msa = 0; arr[0] = ar[0]; for ( ...

  10. 共享有线实现手机上网,然后使用charles来抓包

    问题描述:共享有线实现手机上网(http://support1.lenovo.com.cn/lenovo/wsi/htmls/detail_1323385217890211.html)  [建议] 还 ...