JavaScript functions in ADFLib - jdev 11.1.2.3

Hello:
I would like to create an ADF Library that has many JavaScript functions and any application that adds this ADF Library to its project should be able to use the javascript functions.
Or is there a better way to accomplish this?
I'm following the Enterprise Structure of creating ADFLibs for : Common Code, Common Model, Common UI
Subsystems then import these ADFLibs
The Master app, imports the ADFLibs and the Subsystems and uses subsystem taskflows in the Master to complete the application.
In my case, I would like to execute the same JavaScript in both the Subsystem and the Master. So I think I should put the JavaScript in the Common UI adflibrary or what???
What is the best way to structure this to be able to reuse the Javascript in multiple apps?
Is there any articles/samples that you can reference?
Thanks for the help.

Thanks...
I have watched this video. It was very helpful but not seemingly enough for this issue.
My first try was to put the JavaScript in the CommonUI, but then I could not figure out how to reference it in the adflib as the JavaScript library is relative to the context path. So I still have not figured this out yet.
Thanks for the help.

Similar Messages

  • Error when calling a Javascript function loaded as a library

    Hi All,
    I have some javascript functions in a custom js file which is in OA_HTML dir. I have loaded this js library using pageContext.putjavascriptlibrary("ABC","custom.js") in processRequest. When I deploy my code, there is a javascript error in the page. It does not seem to find the javascript function.
    My code in PR is :
    pageContext.putjavascriptlibrary("ABC","custom.js")
    someBean.setOnFocus("javascript: callFunc(this);"); //callFunc(obj) is defined in custom.js
    It works locally when I have my custom.js in myhtml directory. I am getting an error when I deploy the code on to the instance's apps server. Is there something that I am missing?
    Thanks in advance
    Raja

    Raja,
    You can bounce apache , and server cache would be refreshed!I guess then ur updated js function should work. Also,check ur js function works correctly on jdev.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                               

  • Undefined in alert of JavaScript Function

    Dear All
    i have the below source of my jsf page, it contains java script small function (to access input text component) & get its value and show it in alert, but i am facing "*undefined*" instead of the value in the alert , please advise
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <af:document title="untitled2.jsf" id="d1" binding="#{backingBeanScope.backing_untitled2.d1}">
    <af:messages id="m1" binding="#{backingBeanScope.backing_untitled2.m1}"/>
    <af:form id="f1" binding="#{backingBeanScope.backing_untitled2.f1}">
    *<af:resource type="javascript">*
    *function checkval() {*
    var val = document.getElementById('it2');
    alert(val.value);
    *</af:resource>*
    <af:panelStretchLayout topHeight="50px" id="psl1" binding="#{backingBeanScope.backing_untitled2.psl1}">
    <f:facet name="top">
    *<af:inputText value="#{bindings.EmployeeId.inputValue}" label="#{bindings.EmployeeId.hints.label}"*
    *required="#{bindings.EmployeeId.hints.mandatory}"*
    *columns="#{bindings.EmployeeId.hints.displayWidth}"*
    *maximumLength="#{bindings.EmployeeId.hints.precision}"*
    *shortDesc="#{bindings.EmployeeId.hints.tooltip}" id="it2"*
    *binding="#{backingBeanScope.backing_untitled2.it2}" clientComponent="true">*
    <f:validator binding="#{bindings.EmployeeId.validator}"/>
    <af:convertNumber groupingUsed="false" pattern="#{bindings.EmployeeId.format}"/>
    <f:facet name="context"/>
    </af:inputText>
    </f:facet>
    <f:facet name="center">
    <af:panelGroupLayout layout="scroll" id="pgl1" binding="#{backingBeanScope.backing_untitled2.pgl1}">
    <af:inputText label="Label 1" id="it1" binding="#{backingBeanScope.backing_untitled2.it1}"
    clientComponent="true" autoSubmit="true"/>
    *<af:commandButton text="commandButton 1" id="cb1"*
    *binding="#{backingBeanScope.backing_untitled2.cb1}" clientComponent="true"*
    *partialSubmit="true">*
    *<af:clientListener method="checkval" type="action"/>*
    </af:commandButton>
    </af:panelGroupLayout>
    <!-- id="af_one_column_header_stretched" -->
    </f:facet>
    </af:panelStretchLayout>
    </af:form>
    </af:document>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_untitled2-->
    </f:view>

    Dear All
    i made all the above solutions but still facing the same error, but i need another help, i found in oracle doc regarding this, the below statement
    Absolute expressions use the fully qualified JSF client ID (meaning, prefixed with the IDs of all NamingContainer components that contain the component) with a leading NamingContainer.SEPARATOR_CHAR character
    You can determine whether or not a component is a naming container by reviewing the component tag documentation. The tag documentation states whether a component is a naming container.
    so can any one help me to know the a naming container list of jsf components for 11.1.2.0 JSF 2.0 ?
    thanks
    Edited by: Oracle ITself on Sep 5, 2011 12:51 AM

  • JavaScript function which fetches return_value from List of Values

    Hi,
    I have created List of Values named "NICKS". I want to write JavaScript function "get_workers_fullname(nick)" which returns display_value from List of Values. The parameter of function is return_value of List "NICKS".
    I am new with this and don't know how to handle this case.
    Please help me.

    Hi,
    The LOV, I mean is the item in Application's Shared Components. I don't mean the visible SelectList on the page.
    This is what I found in ApEx's help: "A List of Values can be referenced by page items as well as report fields. It controls the values displayed and limits the user's selection. Lists of Values can be static (based on values you enter) or dynamic (based on a SQL query)."
    I'd like to access values in such LOV from JavaScript. I am not sure it is possible.
    Cheers,
    Tom.

  • Passing value from javascript function to servlet

    Hello everybody,
    i need to pass parameter from javascript function to servlet.
    what i wrote is :
    function callPopulateServlet(t)
    var h =document.NewRequest.services;
    var y = t.selectedIndex;
    alert(h.options[y].value);
    var id=h.options[y].value;
    <%session.setAttribute("id",id);%> // am getting error at this point
    document.NewRequest.submit();
    with this id am quering values from database through servlet.
    any body knows plz help me.
    thanks,
    anil.

    this is the error am getting
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

  • How to pass value to pop up window using javascript function?

    I am not sure how to do this, I want to open new window from existing form,This is Mod/PLsql for consists some javascript functions also. When I am clicking on new window in form then new form should open with results of value entered,but new window form is opening with main page :( , not able to get text box value from parent form. How to call textbox input value in popup window from parent window using javascript?
    currently I'm using following code:
    HTP.p('<script type="text/javascript">
    function pop_up5()
    var l_url=window.opener.document.getElementById("p_single_store_pc").value;
    window.open(l_url, '''', ''fullscreen=no, scrollbars=1'');
    </script>' );
    Edited by: user11970612 on Jun 14, 2012 5:02 AM

    this is probably due to the Javascript code and not a "real link" to another page... I don't know if the null is due to the Javascript...
    But if you really really want to use javascript instead of a ... you can pass the location of the url with JSP (on your main page) as a parameter to the open window... (...) u can put instead of main.jsp <%= request.getServerName()+request.getRequestURI() %>
    the value <%= ... %> will return something like test.com/html/main.jsp
    Hope this helps.

  • How can I have a backing file call a JavaScript function?

    I have a Weblogic portal with a JSP portlet. The portlet has a backing file. How can I get the backing file to call a JavaScript function in my portlet?
    thanks

    Hi
    your questions are not correct because you are mixing up server side operations with client side operations.
    First server side code executes then the page is sent to the browser , then any javascript executes on the browser. So asking for javascript to be called from backing file (server side) doesn't make sense or asking for javascript to read a parameter doesnt exactly work either.
    However in your server code suppose you have a variable action in the request that you want javascript to know then in your JSP you would add something like
    <script type="text/javascript">
    var action = '${requestScope.action}';
    alert(action);//or whatever you want to do
    <c:if test="${requestScope.someOthervariable == ''xyz'}"><%-- this check is done on the server --%>
    callSomeJavascript(); <%--this javascript is only executed when the server side value of someOtherVariable is xyz --%>
    </c:if>
    </script>
    i.e. you can output the javascript that has the variables you need or the function calls you want.
    Like I said understand whats server side and whats client side.

  • How can I call a custom javascript function when clicking on cfgrid cell.

    I would like to call a custom javascript function when
    clicking on a cell in an cfgrid (of html format). The closest thing
    I can find is to use the HREF="" attribute, but it doesn't seem to
    work with javascript inside it.
    Simple example:
    <cfgridcolumn name="Foo" header="Foo"
    href="javascript:customFunction(#ID#);">
    Do I need to tap into the underlying Ext JS funtionality? If
    so, where can I start?
    Thanks!

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How can I call a servlet method from a javascript function

    I want to call l a servlet method from a javascript function.
    Does any one have an example of code.
    Thinks in advance

    Actually, as long as the servlet returns valid javascript, you can indeed "call it" from the client. It will initiate a request and return the result to the browser.
    This example uses Perl, but it could be easily modified to go to a servlet instead.
    Note that it is only supported in DOM browsers (IE6+/NN6+/etc)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    <title> Test server-side JS </title>
    </head>
    <body>
    <script type="text/javascript">
    function checkIt(variable, value)
    var newScript = "cgi-bin/validateJS.cgi?"+variable+"="+value;
    var body = document.getElementsByTagName('body').item(0)
    var scriptTag = document.getElementById('loadScript');
    if(scriptTag) body.removeChild(scriptTag);
    script = document.createElement('script');
    script.src = newScript;
         script.type = 'text/javascript';
         script.id = 'loadScript';
         body.appendChild(script)
    </script>
    <p>Test.</p>
    <form id="f1" action="">
    <input type="text" name="t1" id="t1" onChange="checkIt(this.name, this.value)">
    </body>
    </html>
    validateJS.cgi
    #!/opt/x11r6/bin/perl
    use CGI qw(:all);
    my @valArray = split(/=/,$ENV{QUERY_STRING});
    print "Content-type: text/javascript\n\n";
    # myPass is the password
    $myPass = "foobar";
    if ("$valArray[1]" eq "$myPass")
    print "alert(\"Success!!\")";
    else
    print "alert(\"Failure!!\")";

  • How to call a Javascript function from backing bean without any event

    Hi,
    Someone knows how to call a Javascript function from backing bean without any event ?
    thanks

    Please review the following thread:
    ADF Faces call javascript
    Luis.

  • Set multiple items with javascript function in chart link

    Hi Folks
    I am able to use the javascript $s function to set the value of one item from a chart link. I need to pass values to multiple items.
    Is there a way to use javascript function to pass values for multiple items on a page from a chart link
    Appreciate your responses
    Thanks
    Gopal

    Hi Arnau,
    You need to surround your JavaScript code like this (without the spaces before and after script):
    < script language="Javascript">
      window.open("<%=ABAP_VARIABLE%>").focus();
    </script >
    Regards,
    Patrick.

  • How to call a bean method through a javascript function

    I dont discover any problems calling the bean method in this maner:
    <%= helpdesk.data() %>
    But, when I use a Button Onclick= to call the script function and which then is going call my bean method
    an error on the page is reported!
    I have include som code which gives you the idea of what Iam searching for. And is it possible to call
    the bean method without doing from a new jsp page?
    If you have any suggestions to why it doesnt work, please let me know.
    I use Apache Tomcat 4.0
    Best regards Micah.
    <jsp:useBean id='helpdesk' scope='application'
    class='helpdesk.testdb'/>
    <html>
    <head>
    <script language="javascript">
    function broadcast()
    helpdesk.data();
    </script>
    </head>
    <body>
    <input type="button" value="Broadcast" onclick= broadcast()>
    </body>
    </html>

    It's actually quite simple:
    Beans run server-side
    Javascript runs client-side
    So you will never be able to run server-side-code thru the client...

  • Assigning return value of a javascript function to a variable

    hi.
    I have a javascript function which returns string.
    I wanna assing return value of that function to variable.
    for example:
    <script>
    funtion writeMe()
    var ex;
    ex="try"
    return ex;
    </script>
    Then in body of JSP page. I wanna do something like:
    <% String st;%>
    Now I wanna assign the value that returned from writeMe function ("try") to st string.like:
    <%st= writeMe();%>. but of course it doesn't work. how can I do that?

    thnx. but actually what I want to do is sending some values produced by javascript to a barchart object. is it impossible too?
    I mean my script function returns something like "100, 200, 300". I wanna pass that values to barchart. when I want to add aplet tag to jsp code instead of writing:
    <param name="s1_value" value="100,200,300">
    I want to write somethin like:
    <param name="s1_value" value="myscriptfunction()">
    is it possible in JSP? I saw an example like this in asp. it was like:
    <param name="sampleLabels" value="<%call func1()>">. but in JSP it seems like call tag doesn't work. Is it possible in JSP?

  • Error in calling a javascript function

    Hi
    Below is a code from my HTML file...
    <html>
    <head>
    <script language="javascript" >
    function try()
    alert("hi");
    </script>
    </head>
    <body>
    <input type="button" value="Hello world!"
    onclick='try();'>
    </body>
    </html>while running page in browser i m getting error :
    line: 12
    char: 4
    error: expected "{"
    I understand that this is not a java problem but please help.
    thanx
    Edited by: money321 on Feb 5, 2008 6:07 AM

    I know that this is not the right forum, but I'd like peoples' advice on which prep to use for a colonoscopy. The Fleet's Phosphosoda prep is more palatable, and easier and more convenient to take compared to the Colyte (gallon jug) prep, but on the other hand the Colyte prep is safer since it doesn't carry the risk of calcium phosphate precipitates forming in the kidneys potentially causing acute kidney failure, a rare but certainly serious complication. Many thanks in advance.

  • Binding to a javascript function is not working

    I am trying to use the following code to bind to a javascript
    function and it's not working. I finally had to use jQuery to bind
    the event handler, but I would like to see the CF generated stuff
    work. Am I missing something here?
    This jquery code is the workaround:
    $('.match').change(function(){
    updateSA(this);

    Binding is not restricted to flash forms. I can bind directly
    to a cfc without problems, but in this case I need to send more
    info to the cfc than a single field would provide. You're supposed
    to be able to bind to a javascript function using the syntax above,
    but it's not working properly.
    More details here:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=ajaxdata_03.html#1128486

Maybe you are looking for

  • Opportunities Partner Tables

    Hi All, I am creating a report in CRM regarding OPP. I am finding hard time locating tables for sales team of the OPP. I checked CRMD_ORDER_INDEX which gives me all the partner detail but i also want the PARTNER FUNCTION along with partner details. I

  • How do I get my unlimited data plan back

    Upgraded my phone at a verizon booth in a SAM's club and was told that nothing would change on my plan. They activated the phone and got everything all set up so I didn't skip a beat. A couple days later I receive a text from VZW that I was close to

  • Container Element Text Being Truncated in Email

    Hello, If a user rejects a Purchase Requision, I have added a Hard Check (BADI)  that requires the user to enter a "Reason for Rejection." In my BOR (ZBUS2105) GET_DATA method, I retrieve the "Reason for Rejection" text and add it to the Container. I

  • Changing default name in screen sharing

    I've been trying to find out how to change the default name which pops up in screen sharing when I use finder to remotely log in to my mac mini.  Basically, I want the login to be automatic, without having to mess with user accounts on either compute

  • Can not get a logo to link to the index page.

    Every month I change the monthly sponsors for our tournaments.  I removed last month sponsors and want to replace with this month in DW.  I put my cursor where I want the logo to go and I can not get it to link.  I want to replace the Main St Jeweler