Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

November 22, 2016

TypeError: h.apply is not a function

This is a Knockout JS error. I faced this issue when I am trying to invoke click action of a link created. My link statement is like below.

<a data-bind="attr:{id:Reqid},text: Title,click: $('#popup1').ojPopup('open', '#btnTitle')"></a>

And on click of this link, I am getting the below error.

TypeError: h.apply is not a function

This is because the click handler needs to be wrapped within a function. Below updated statement resolved the issue.

<a data-bind="attr:{id:Reqid},text: Title,hover: function(){$('#popup1').ojPopup('open', '#btnTitle')}"></a>

September 10, 2014

Displaying alert message on AMX page from Managed Bean

Below java code is useful to display alert messages on AMX pages in MAF from managed bean.

   "function(){navigator.notification.alert('<message>',  function(){}, '<alert-title>', '<button-text>');}",
   new Object[] { });


"function(){navigator.notification.alert('Request has been submited.',  function(){}, 'Information', 'OK');}", new Object[] { });

<feature-id> is the id of the feature on which you want to display the alert message
<message> is the message you want to display on the alert box
<alert-title> is the tile you want to display on the alert box
<button-text> is the text to be displayed on the button on alert box

June 6, 2013

Invoking javascript method from an ADF component

This post is to show how we can invoke a java script method from an ADF component like af:goLink

Write a javascript. We can also use external javascript file but in this example I am writing a small
javascript method using af:resource. Below is my java script method.

<af:resource type="javascript"> 
function sayHello() {
alert(“Welcome to Hello World”);}

Create a af:goLink component on the JSF page like below.

<af:goLink text="Click here" id="gil1" >
<af:clientListener method="sayHello()" type="mouseUp"/>

Webcenter Portal Display issues in lower versions of IE

I have a portal application developed in JDev 1.6. While running the application, it supposed to be 
displayed full of the browser and it is in Firefox, Chrome and even in IE (version greater than 8). But 
I have a requirement to use this in IE7. When I run this app in IE7, the app is displaying in one third 
of the browser. To make my app displays properly in IE7, I need to write some browser specific 
javascript. Below is my javascript code added to my home page. This script will be executed when 
the browser is IE and its version is 7.

<af:resource type="javascript"> 
browser_version= parseInt(navigator.appVersion);
browser_type = navigator.appName;
if (browser_type == "Microsoft Internet Explorer" ) {
if((browser_version == 4)){
var lineURL = "&lt;style&gt;.af_decorativeBox { width: 100% !important;height: 640px
 !important;}div.af_decorativeBox_center{overflow: hidden !important;}div.af_panelTabbed_body {overflow: auto;}.profileSubHeader{ margin-left: -10px !important}.wid50 input {width: 35px !important;}&lt;/style&gt;";


In the above code, lineURL is a variable which holds css styles which will impact my display in IE7.