Let us walk through an example on how to invoke a peoplecode event from a javascript in a HTMLAREA.
Here is a test page which contains a push button that display a winmessage on FieldChange.
Let us see what happens behind the scenes when we click on the push button by inspecting the HTML.
We can see that the onclick event on the push button invokes the javascript function (delivered) submitAction_win0(document.win0, this.id, event). In this case, this.id would be equal to CSK_TEST_WRK_TEST. The general format for the id field would be <RECORD_NAME>_<FIELD_NAME>. This would translate to <RECORD_NAME> = CSK_TEST_WRK and <FIELD_NAME> = TEST.
Now let us include a HTMLAREA on the page.
Include the following HTML and javascript in the HTMLAREA properties. Note: I am using a constant HTML value for the purposes of this example.
HTML Code:
<script>
function myFunction() {
submitAction_win0(document.win0,"CSK_TEST_WRK_TEST", event);
}
</script>
<a href="#" onclick="myFunction()">Push Button in HTMLAREA</a>
Updated HTML Code - 20151105 - Thanks to @Santiago.gmerino's comment below:
<script>
function myFunction() {
// submitAction_win0(document.win0,"CSK_TEST_WRK_TEST", event);
// Use %formname to resolve _win# dynamically.
submitAction_%formname(document.%formname,"CSK_TEST_WRK_TEST",event);
}
</script>
<a href="#" onclick="myFunction()">Push Button in HTMLAREA</a>
Now let us test the javascript in the HTMLAREA.
We can see the hyperlink that we added in the HTMLAREA appear on the page. Let us click the hyperlink 'Push Button in HTMLAREA'. This should trigger the FieldChange event on the push button CSK_TEST_WRK.TEST.
Note: At the time of writing this post, I am using HCM 9.2 PUM Image 12 - PeopleTools 8.54.08.
Here is a test page which contains a push button that display a winmessage on FieldChange.
Let us see what happens behind the scenes when we click on the push button by inspecting the HTML.
We can see that the onclick event on the push button invokes the javascript function (delivered) submitAction_win0(document.win0, this.id, event). In this case, this.id would be equal to CSK_TEST_WRK_TEST. The general format for the id field would be <RECORD_NAME>_<FIELD_NAME>. This would translate to <RECORD_NAME> = CSK_TEST_WRK and <FIELD_NAME> = TEST.
Now let us include a HTMLAREA on the page.
Include the following HTML and javascript in the HTMLAREA properties. Note: I am using a constant HTML value for the purposes of this example.
HTML Code:
<script>
function myFunction() {
submitAction_win0(document.win0,"CSK_TEST_WRK_TEST", event);
}
</script>
<a href="#" onclick="myFunction()">Push Button in HTMLAREA</a>
Updated HTML Code - 20151105 - Thanks to @Santiago.gmerino's comment below:
<script>
function myFunction() {
// submitAction_win0(document.win0,"CSK_TEST_WRK_TEST", event);
// Use %formname to resolve _win# dynamically.
submitAction_%formname(document.%formname,"CSK_TEST_WRK_TEST",event);
}
</script>
<a href="#" onclick="myFunction()">Push Button in HTMLAREA</a>
Now let us test the javascript in the HTMLAREA.
We can see the hyperlink that we added in the HTMLAREA appear on the page. Let us click the hyperlink 'Push Button in HTMLAREA'. This should trigger the FieldChange event on the push button CSK_TEST_WRK.TEST.
Note: At the time of writing this post, I am using HCM 9.2 PUM Image 12 - PeopleTools 8.54.08.