Programmatically generating an ADF Action Event through Javascript

Hi,
I have a requirement of generating an ADFActionEvent programmatically. I have written the following
<af:commandButton text="commandButton 1" id="cb1"
action="#{mybean.mymethod}">
</af:commandButton>
function parent()
// here we need event
// so i have done this code but its not working
var event=new AdfActionEvent("AdfRichCommandButton [oracle.adf.RichCommandButton] id=cb2");
event.Init("AdfRichCommandButton [oracle.adf.RichCommandButton] id=cb2");
event.propagatesToServer();
childfunction(event);
function childfunction(event)
var source = event.getSource();
Wanted to know how can we call action of button from java script.
i need this because i am calling java script from html and adf page is iframe here
so i want to call action of button from parent html page through java script.
i am successful to call child iframe java script function but not with event .

You need to use the ADF Faces JavaScript API to queue an event and listen to it with a serverListener.
See for example:
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/004-auto-suggest-169120.pdf
and
http://biemond.blogspot.com/2010/11/adf-faces-rich-client-development.html

Similar Messages

  • How to trigger the "click" event using javascript in LC8?

    I have 2 button in the form. I don't want the user to click the button1 directly (invisible now). but I want the user click the button2 and then do some checking. after checking is finisined,  the script will continue to trigger the button1 "click" event. How to trigger the button1 "click" event through javascript in LC 8? Thanks.

    button2.execevent("click");

  • Edit single item in Recurrence event through CSOM/javascript + SPService Library

    Hi,
      I've a requirement that I've custom action ribbon button. In a calendar list, there is a Person/Group field named "Attendees". I want to add current user to this field when the user click the ribbon button. I've implemented but the problem
    is I cant update the single item of recurrence event. Becuase recurrent event ID are different and not able to get the item. Using the below link, I got all the recurrence items, but i want to update the field of specific single item in recurrence item.
    https://www.nothingbutsharepoint.com/sites/eusp/Pages/Use-SPServices-to-Get-Recurring-Events-as-Distinct-Items.aspx
    Is it possible to edit the single item of recurrence event. If yes, please let me know. And one more, I don't want to implement this approach with workflow. Other than workflow, I want to implement this functionality. Please suggest. 
    Balaji -Please click mark as answer if my reply solves your problem.

    Hi  ,
    According to your description, my understanding is that you want to edit the single item of recurrence event using javascript.
    For your issue, you can refer to the steps as below:
    1. Create a list ribbon.
    2.When ribbon is clicked, get the selected event.
    3.If  the selected event is recurrence event, go to 4.If not, go to 6.
    4.If the selected event is modified recurrence event, update its "Attendees" column. If not, go to 5.
    5.Create a new event,set its MasterSeriesItemID to the ID of the selected recurrence event,set EventType to 3, set   its UID to the
    UID  of the selected recurrence event, set its  fRecurrence to 1, set RecurrenceID to the EventDate of the selected recurrence event and so on.
    6.Update its "Attendees" column.
    Reference:
    http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/03/25/how-to-programmatically-delete-a-single-instance-of-a-recurring-event-in-a-sharepoint-calendar.aspx
    http://social.technet.microsoft.com/Forums/office/en-US/f3b2ed46-d748-4aed-8b1c-765306ef3be0/how-update-fields-on-recursive-calendar-items?forum=sharepointdevelopmentlegacy
    http://stackoverflow.com/questions/2811756/update-item-has-recurrence-in-sharepoint
    http://aspnetguru.wordpress.com/2007/06/01/understanding-the-sharepoint-calendar-and-how-to-export-it-to-ical-format/
    http://sharepointtechie.blogspot.com/2010/08/deleting-individual-events-from.html
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Handling events in javascript which are generated by embedded applet

    I am having an tipical requirement , In my HTML page there is an embedded applet . This applet is going to generate custom events . I would like to handle that events in javascript which are generated from applet . I mean that javascript has to get a notification of the event that is generated from applet . I would appreciate if some one can send me the code .

    Hi look at my post further down about 5-6 posts. It's called: "For your information. Very interesting." It talks about Netscapes Live Wire.

  • Temparally remove rows from a ADF table by action event of a jsf page.

    Hello Developers,
    I needed to temporally remove rows of a ADF table when execute action event of corresponding page.
    So in this case my task can describe by following steps,
    (1). I created a ADF table using <af:table> on a jsf page.
    (2). The data populated using a VO.
    (3). Several radio buttons added to the page for temporally remove rows from the table.
    This means one radio button check, it responsible to temporally remove rows which contain empty cell values of a identified column.
    If I check another radio button it should temporally remove identified data included rows but above removed (empty cell included rows) rows should appear in this event
    My ultimate target is temporally remove rows of a table & re call again removed rows another event without again & again query from BC.
    Pleas advice me to archive this task very sealy?
    (Are there have a way to do this using EL or coding in Manage bean ?)
    Thanks in advance..!

    Hi,
    the DCIterator gives you an option to iterate over the fetched rows (the ones you see in the table). You can try call removeAndRetain() on these rows. This will not remove or delete rows but allows you to insert these rows back to the collection.
    JavaDocs:
    * Removes the row from the collection and then retain it for insertion
    * into another location.
    * <p>
    * This method differs from <code>{@link #remove()}</code> in that
    * it just removes the row from the collection. It does not
    * remove the underlying Entity row(s) or database row(s).
    * <p>
    * This method also differs from <code>{@link #removeFromCollection()}</code>
    * in that after the row is removed from the collection, it can be inserted
    * back into the collection at another location.
    void removeAndRetain();
    Frank

  • Call actions through javascript

    Hi Everyone,
    Currently i'm doing automations for Adobe Illustrator CS4. I have created some actions due to the limitations of scripting in Illustrator. I need to call this actions through javascript.
    But in applescript i can able to call the actions by using the do script method.
    Can anyone help me in this regard.
    Thanks in advance
    Thiyagu

    May this can help you. VBS version:
    Set appRef = CreateObject("Illustrator.Application")
    'action name "Convert to grayscale", action set"action1"'
    appRef.DoScript "Convert to grayscale", "action1"
    'sleep 2 sec, waiting for the action complete, this is needed if you want to do something else'
    WScript.sleep 2000
    ' then do something else here

  • How to generate selection change event through code in JTree?

    I am developing an application which downloads the file from other system and adds it into the tree. On selecting any file in the tree I m displaying it's contents. But now i am trying to display the contents of downloaded file as soon as it's download completes. Here i am not getting the way to how to generate the event as the download completes, because i tried that setSelectionPath(TreePath path), but it also don't generates the selection change event. Is there any other way to do so?

    Put null in place of oldLeadSelectionPath. From the API for TreeSelectionEvent:
    protected TreePath     oldLeadSelectionPath:
    leadSelectionPath before the paths changed, may be null.
    I'm at the office and can't try out anything, so please let me know whether that works for you.
    db
    edit Or it may be easier to put all code from your valueChanged (...) override in a new method and invoke that method both from valueChanged (...) and wherever else you need.
    Edited by: Darryl.Burke

  • How to pass params to Action Event handler in treeNode?

    Trying to use Tree in portlet I found impossible to determine selected node. (bug # 6354989).
    But I can (despite what is written in manual) use Action Event Handler. It works now (at least, I hope so).
    But I generate tree dynamically and cannot write event handlers for all its nodes. May be there's a way to write one event handler but distinguish node that triggered it? May be by passing additional params to handler?

    The tree component does not work well in portlets. This is a known problem.
    It uses cookies to pass the value of the selected node, but cookies do not work inside of portlets. So, the methods that would normally tell you which node is selected, return nothing. There are also no javascript properties which would allow you to output javascript to store the value somewhere in the page.
    Unfortunately there is no workaround for the bug you mentioned so far so far.
    Rose

  • netui:form how do i create Action URL in JavaScript

    hi,
    i want to submit the <netui:form> along with action form data to JPF from the
    java script,
    i can call the action method from the java script but actionForm is not passing
    to JPF....
    pls guide me....
    vijay

    The javascript that you suggested is similar to what we're using. When the onChange
    message is fired, both bits of javascript produce the following url;
    http://localhost:7001/mpsportal/getVersion.do?product_id=1
    This works fine in the weblogic browser but not in portal. If you use an anchor
    to fire the action, portal creates the following url;
    http://localhost:7001/mpsportal/mpsportal.portal?_nfpb=true&portlet_1_1_actionOverride=/portlets/task/getVersion
    So I've tried to put the 'extra bits', namely 'mpsportal.portal?_nfpb=true&portlet_1_1_actionOverride=/portlets/task/'
    into the javascript as below;
    javascript:window.location='mpsportal.portal?_nfpb=true&portlet_1_1_actionOverride=/portlets/task/getVersion.do?product_id='+document.forms[0][getNetuiTagName('product_id')].value;
    When this is run in portal it produces exactly the same url that portal produces
    except it has the parameter tagged onto the end;
    http://localhost:7001/mpsportal/mpsportal.portal?_nfpb=true&portlet_1_1_actionOverride=/portlets/task/getVersion.do?product_id=1
    Unfortunately portal doesn't like the parameter on the end and gives an error
    message 'Unable to find action getVersion.do?product_id=1'. The problem is that
    the value on the form, the product id in this case is not stored when the javascript
    jumps back to the server so it has to be sent in the url.
    If we can find a way of sending these values through in the url without portal
    complaining OR forcing the form to submit its values then its problem solved.
    Thomas Cook <[email protected]> wrote:
    Does this work?
    onChange="javascript:window.location='getVersion.do?product_id='+document.getElementById(getNetuiTagName('product_id',
    this)).value;"
    When you say the problem is in the onChange() method in the NetUI tag,
    can you elaborate on what you think might be happening?
    Thomas
    Steve Hicks wrote:
    Thomas
    We want to get java script to work with a netui:select tag so that whenthe user
    selects it, we populate a different netui:select tag (this requiresa call back
    to weblogic). Nothing to do with forms in Vijay's post!
    Here is a portion of our JSP:
    <td>
    <netui:select dataSource="{actionForm.product_id}"
    optionsDataSource="{pageFlow.taskProduct.taskProductSL}" nullable="false"multiple="false"
    onChange="javascript:window.location='getVersion.do?product_id='+document.forms[0][getNetuiTagName('product_id')].value;"
    tagId="product_id"></netui:select>
    </td>
    This works in the workshop debugger but NOT when we use it via portal(where nothing
    happens). The problem is in the javascript 'onChange' method in thenetui tag...
    Regards
    Steve H
    Thomas Cook <[email protected]> wrote:
    Getting back to Vijay's original post - something like the following
    should work (I can't confirm this code works since I'm in the middle
    of
    a build), but I have done this before. Does this not work? It should
    submit the form from javascript, as Vijay requests, passing the field
    value to the JPF via the action form.
    <netui:form tagId="myForm" action="doSomething">
    <netui:textBox dataSource="{actionForm.doSomethingValue}"/>
    <netui:button value="Submit" onClick="return doSubmit()"/>
    <script language="javascript">
    function doSubmit()
    var form = document.getElementById( getNetuiTagName( "myForm",
    this ) );
    form.method = "post";
    form.submit();
    return true;
    </script>
    </netui:form>
    Steve Hicks wrote:
    We have this problem and it seems quite sad that you can not perform
    this (typical)
    function using portal. Anyone from BEA watching? Could they do something
    about
    this in sp3?
    "Anant Kadiyala" <[email protected]> wrote:
    Beware that it is not entirely good idea to have action url in the
    Javascript.
    I had some problems with it. It works fine when you test it at the
    pageflow
    level.
    But when you pull the pageflow into a portlet, it starts acting strange.
    The urls
    that the portal generates behind the scenes dynamically, get messed
    up
    and you
    will notice that the new acion opens in a new browser window and
    will
    not have
    the context of the portal.
    Although the docs say we could use action urls in Javascript, youmight
    want to
    make sure it works in the portal context.
    Anant
    "julie" <[email protected]> wrote:
    do you still need help making an action url in javascript?
    "vijay patel" <[email protected]> wrote:
    hi,
    i want to submit the <netui:form> along with action form data to
    JPF
    from the
    java script,
    i can call the action method from the java script but actionForm
    is
    not
    passing
    to JPF....
    pls guide me....
    vijay
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
    <title></title>
    </head>
    <body>
    Getting back to Vijay's original post - something like the following
    should work (I can't confirm this code works since I'm in the middle
    of
    a build), but I have done this before. Does this not work?
    It should
    submit the form from javascript, as Vijay requests, passing the field
    value to the JPF via the action form.<br>
    <br>
    <tt><nobr><netui:form tagId="myForm" action="doSomething"></nobr><br>
    <nobr> <netui:textBox
    dataSource="{actionForm.doSomethingValue}"/></nobr></tt><br>
    <tt><nobr> <</nobr><nobr>netui:button value="Submit"
    onClick="return doSubmit()"/></nobr><br>
    <nobr> <script language="javascript"></nobr><br>
    <nobr> function </nobr></tt><tt><nobr>doSubmit</nobr></tt><nobr></nobr><tt><nobr>()</nobr><br>
    <nobr> {</nobr><br>
    <nobr> var form = document.getElementById(
    getNetuiTagName(
    "myForm", this ) );<br>
    form.method = "post";<br>
    form.submit();</nobr><nobr></nobr></tt><tt><nobr></nobr><br>
    <nobr> return true;</nobr><br>
    <nobr> }</nobr><br>
    <nobr> </script></nobr><br>
    <nobr></netui:form></nobr></tt><br>
    <br>
    Steve Hicks wrote:<br>
    <blockquote cite="[email protected]" type="cite">
    <pre wrap="">We have this problem and it seems quite sad that youcan
    not perform this (typical)
    function using portal. Anyone from BEA watching? Could they do something
    about
    this in sp3?
    "Anant Kadiyala" <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]"><[email protected]></a>
    wrote:
    </pre>
    <blockquote type="cite">
    <pre wrap="">Beware that it is not entirely good idea to have action
    url in the Javascript.
    I had some problems with it. It works fine when you test it at thepageflow
    level.
    But when you pull the pageflow into a portlet, it starts acting strange.
    The urls
    that the portal generates behind the scenes dynamically, get messedup
    and you
    will notice that the new acion opens in a new browser window and will
    not have
    the context of the portal.
    Although the docs say we could use action urls in Javascript, you might
    want to
    make sure it works in the portal context.
    Anant
    "julie" <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]"><[email protected]></a>
    wrote:
    </pre>
    <blockquote type="cite">
    <pre wrap="">do you still need help making an action url in javascript?
    "vijay patel" <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]"><[email protected]></a>
    wrote:
    </pre>
    <blockquote type="cite">
    <pre wrap="">hi,
    i want to submit the <netui:form> along with action form data to
    JPF
    </pre>
    </blockquote>
    <pre wrap="">>from the
    </pre>
    <blockquote type="cite">
    <pre wrap="">java script,
    i can call the action method from the java script but actionForm is
    </pre>
    </blockquote>
    <pre wrap="">not
    </pre>
    <blockquote type="cite">
    <pre wrap="">passing
    to JPF....
    pls guide me....
    vijay
    </pre>
    </blockquote>
    </blockquote>
    </blockquote>
    <pre wrap=""><!---->
    </pre>
    </blockquote>
    </body>
    </html>

  • How to set fire action event for particular rows in a table

    HI All,
    I have a requirement in which I want to set fire action event for particular rows in a table based on some condition.
    The table has columns like fullname,employee id etc.
    So i want to set fire action event for particulars rows only which will saisfy some condition.

    Atanu,
    Your approach(setting fire action for few rows) seems not possible. Better to go ahead with workaround.
    Do you want this functionality in processRequest(while page loading) or processFromRequest(on some event) method ? Give more explanation regd. your requirement ?
    In either case loop through the rows and when your condition is met write the action to be performed in controller.
    Regards,
    Anand

  • Javascript block through javascript.enabled false not working as expected in newer versions, any actual way?

    Since a few versions, around 24.0 or earlier, when you toggle javascript.enabled from true to false to block javascript, doesn't work after load a page.
    Further details:
    1.- load a page with javascript enabled
    2.- toggle javascript preference to block javascript (javascript.enabled from true to false)
    3.- if you interact with javascript elements = they still work
    This wasn't this way in earlier versions.
    You can check in the following page. You'll see that the only way to actually block javascript execution is to load the page with the preference javascript.enabled set to false (A.K.A. javascript blocked):
    http://www.geocities.ws/jothache/event_listener.html
    Note: to easy change javascript preferences, for those don't want to play with about:config you can use addons like QuickJava:
    https://addons.mozilla.org/en-US/firefox/addon/quickjava/
    I find that how it works now, in the latest versions, it is a VERY HUGE SECURITY ISSUE as javascript is never actually blocked when the preference is toggled and AJAX (httpXMLrequest through javascript) still works so the possibilities of lost of privacy inreases, as for example, mouse tracking and send it to the server, not only as the example scripts I posted above.
    The question is, is there anyway to really block javascript in the latests versions or should I report this as a bug?
    Regards.

    Hi guigs2,
    if there is no problem in open the bug ticket being a simple user I'll report by myself (if I haven't misunderstood you). (Confirm this and I'll do myself).
    About the AJAX problem, here we have a sample test that works after toggle the preference:
    http://www.w3schools.com/xml/xml_http.asp
    I know about noscript and I don't like it. I prefer to do manually (those measures and more). What bothered me is that even toggle the preference, what in the past did the job of stopping the execution of scripts, now doesn't. In about version 24 it was only happening to event listeners not being blocked (used nowadays for dynamic events assignments). Now is with every javascript code.
    About the tracking methods, I'm aware of HTTP tracking without any need of javascript. Even a simple "knock knock" on any kind of server leaves a trace.
    I was just pointing that this preference stopping doing its job (stopping scripts executions) has the worst sceneario in a security way with XMLHttpRequest calls.
    But one of the things that bothers me too, and it is not related to tracking, is that, in humble machines as mine, some javascript codes make drop whole performance and the preference toggle now does nothing, so the script keeps running without being able of doing anything and sometimes you don't have the option to load a page without javascript because you need some feature of that page that requires javascript what becomes "all or nothing".
    Regards.

  • Programmatically generate password for pdf with data from database

    Good day everyone,
      I would like to know is it possible to programmatically generate passwords for pdf??
    The main idea is to enable an automated process of pdf acquiring individualised password from a database (Excel, Access, you name it) and finally sending the pdf to individual recipient. Can I use javascript for this? And if yes, how?? If not, pls do advice me on the appropriate steps.
    Background (for clarity's sake): 
      Currently I am working on developing an automated process for the sending customised, password encrypted payslip to about 80 staff. The entire procedure is pretty much summarized as below:
    mail merg (UBS output in) excel to words -> convert words to pdf -> programmatically password encrypt the pdf -> email to individual recipients.
    Well my current status is - I am quite done with the batch mail merge and convertion part. And batch proccessing of password encryption is not a problem, but the idea is to allow acrobat to retrieve password automatically from a database and not key-in each and every password manually. The batch email for now is another problem but for now I have to work stepwise. (Any ideas on how to do it would equally be valued though! =D)
    System and software using:
    Windows  XP and 7 Professional
    Microsoft Office Proffesional 2010
    Adobe Acrobat X Pro
    I would be really grateful for any relevant replies to my question and any additional thoughts or ideas are welcome!!
    I would to thank any potential saviour in advance!
    Thank you for helping!

    Basically I need to automate the password generation from database extract
    e.g. Excel database with StaffID, StaffName, PayMonth, etc. Then when the pdf is created, its password would be <StaffID>_<PayMonth> which is extracted from excel.
    Is it possible for this to happen?? I dont mine using Javascript, I'll just have to learn it.
    Or how about recommending a program which does that??
    Whichever is fine as long there's a solution!
    Thanks!

  • JComboBox Action Event problems

    I have a complex UI with which I am having action event issues. Basically, the panel displays info about an object, which can be selected from within the panel through a button/popup window mechanism. A JComboBox (#1) selection determines the contents of another JComboBox (#2) on the same panel. Currently an ActionEvent fires when the user makes a selection using #1 that updates #2. This fuctions correctly with repeated testing so long as a new object is not selected.
    When a new object is selected from within this panel this ActionEvent no longer fires. JComboBox #1 will be updated correctly and #2 will reflect the initial selection in #1, but user selections in #1 will not fire the ActionEvent and thus #2 is never updated.
    Any help is appreciated. I feel like I'm missing something basic here, but I've stared at it for long enough...

    By the way, the workaround is to use the ItemListener as the ItemStateChanged Event is fired reliably.

  • How to programmatically mimic the user action of selecting a button ?

    I am using JAVA Swings to build a desktop application. The application has many buttons, lists and text boxes etc. I have created actionPerformed methods that monitor the source for user action. I am able to execute the code whenever an action is performed by user manually.
    I also require to save the choices, and texts entered by a user during his active run with the application. This is to avoid user to re-enter all the information once again.
    The problem is to programmatically select those buttons and lists which were saved during users earlier session. How can I perform the action event of selecting a radio button from my java code.

    Kiran,
    Your approach is missing the whole idea of Model-View-Controller. I suspect that somewhere you are saving the data of the user's choices. For example, if you have a checkbox, I suspect you have a java bean somewhere containing a boolean value that is set to true when the checkbox is selected, and false when the checkbox is unselected. This process is mediated by a controller, which has a references to the model (the data) and the view (the UI). The controller sets up as a listener to the actions within the UI, and, when notified, sets the appropriate properties of the data, usually into one or more java beans.
    So, on the reverse side of things, the data is read into the java bean(s), and the controller uses that data to set the state of the UI elements. So, your controller can do something like this:
        uiThing.initUI(yourBean);And in the initUI method you have:
        public void initUI(DataBean data) {
             cbxBlue.setSelected(data.isBlue());
             txtLastName.setText(data.getLastName());
             // etc...
        }If you take that general approach, you'll find you don't need to simulate user actions.
    In the few cases within the UI where you think you do, you really don't. An ActionListener is just a receiver of when something like a button is pressed. If your program needs to do the same thing as when the button is clicked, create a method to perform the processing, and invoke it directly, rather than trying to figure out how to programmatically press a button.
         public void actionPerformed(ActionEvent e) {
              if (e.getActionCommand().equals("BlueButton"))
                  this.setBlue();
              //... etc.
         private void setBlue() {
             // whatever
         // somewhere else in the code
         private void someProcess() {
              // other work
              // other work
              if (someCondition) this.setBlue();  // rather than forcing an action event
              // other work
              // other work
         }

  • Invoking ADF Actions from JS API

    Is there a way to invoke an action from a javascript function? Something that would perhaps mimic what this commandLink does:
    <af:commandLink text="Lights, Camera, Action!"
    id="chuckNorris" action="flyingKick"/>
    What I am looking for is the ability to invoke the action "flyingKick" from a javascript function.

    Thanks, I actually already saw this. What I need though is something that doesn't a serverListener though - a programmatic version of a commandLink with an action if you will.

Maybe you are looking for