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. C Primer Plus(第五版)6

    第 6 章 C 控制语句 : 循环 在本章中你将学习下列内容 已经多次学过,没怎么标注 · 关键字: for while do while · 运算符: < > >= <= ! ...

  2. Error Dropping Database (Can't rmdir '.test\', errno: 17)

    MySql 删除数据库出错:Can't rmdir '.\test\', errno: 17 到test数据下的所在的目前data\test目录,删除掉所有的文件后,就可以删除数据了

  3. 最大子序列和(O(n))

    下面介绍一个线性的算法,这个算法是许多聪明算法的典型:运行时间是明显的,但是正确性则很不明显(不容易理解). //线性的算法O(N) long maxSubSum4(const vector<i ...

  4. (转)如何检查系统是否支持Zend Optimizer

    原文地址:http://blog.chinaunix.net/uid-25266990-id-2978539.html Zend Optimizer 主要有两个功能: 1.可以加速 PHP 脚本的执行 ...

  5. php mysql_affected_rows获取sql执行影响的行数

    php mysql_affected_rows函数用于获取执行某一SQL语句(如INSERT,UPDATE 或 DELETE )所影响的行数,本文章向大家介绍php mysql_affected_ro ...

  6. Java后台工程师面试杂记——不跳不涨工资星人跳槽经历

    经过接近一个月的时间,完成换工作这件“小事”,前后总计面试了多家公司,最后也没接到几个offer,不过最终总算尘埃落定,就对这个过程进行一个总结吧. 在某互联网公司工作了近一年的时间,但是频繁的业务需 ...

  7. 百度面试题:从输入url到显示网页,后台发生了什么?

    参考http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/ http://www.cnblogs.com/we ...

  8. WEB前端研发工程师编程能力成长之路(1)(转)

    WEB前端研发工程师编程能力成长之路(1)   [背景] 如果你是刚进入WEB前端研发领域,想试试这潭水有多深,看这篇文章吧: 如果你是做了两三年WEB产品前端研发,迷茫找不着提高之路,看这篇文章吧: ...

  9. Windows7下安装IIS出现“出现错误,并非所有的功能被成功更改

    1.开始,搜索输入UAC-->选择 “更改用户账户控制设置” 2.调到最低 3.打开控制面板-->程序-->打开或关闭windows功能,去掉图里的2个选项,点确定,重启 4.重启后 ...

  10. 如何由jdk的安装版本改成非安装版本

    背景. 官网一般只提供windows下的exe文件,不提供zip打包文件.有些不愿意使用安装版本. 解决方法 本文以windows 7下安装jdk-6u35-windows-x64.exe为例说明 1 ...