Adding JavaScript Code dynmically to a JSF page

Hi all;
I have a JSF page where I have a dropdown list (<h:selectOneMenu). on the cnahgeEvent of this menu a JavaScript code is called and another dropdown list is displayed with populated data (depending on the selection of the first drop down).
My quesiton is how I can inject the array (of data used by the first dropdown list) (dynamically) . This is because this data is read from the DB and then injected into the JSF page at run time.
any smart ideas ?

If you are looking for a dependent dropdownlist you can use AJAX to accomplish your goal. the onChange event binded to the first list can trigger an ajax request to the server and get the list of data that can be used to populate the second list.

Similar Messages

  • Javascript not loading in my JSF page

    I have a JSF page in which I use the t:popup field, which I can't get to show:
    <tr>
                        <TD><t:popup id="testpop" styleClass="popClass"
                             closePopupOnExitingElement="true" closePopupOnExitingPopup="true"
                             displayAtDistanceX="10" displayAtDistanceY="10">
                             <h:outputText id="obtest" value="pelle" />
                             <f:facet name="popup">
                                  <h:panelGroup>
                                       <h:panelGrid columns="1">
                                            <h:outputText value="Sample Popup Text" />
                                       </h:panelGrid>
                                  </h:panelGroup>
                             </f:facet>
                        </t:popup></TD>
                   </tr>
    I can compile the code without any errors and also load the page successfully with no javascript errors or other errors. However, the popup box does not show up. It is like the JSPopup.js script has not been loaded properly. But if I put an alert() in the JSPopup.js file it displays it on page load???
    On the same page I have an inputCalendar that works as it should, so I would think the correct JAR files have been loaded.
    I also have a home grown javascript:
    <script src="js/scripts.js" type="text/javascript">�</script>
    The function that uses this script only works when the above line is put right before the </body> (not in <HEAD>). This makes me believe that the same problem applies to the JSPopup.js file since it is rendered/included in the <HEAD> section.
    This is driving me crazy. Any ideas are welcome.
    Thanks

    Do you have any security or privacy oriented add-ons? These may include a feature to block content from sites other than the one you're on.
    If you want someone to look at your list, you can copy and paste it from the second table here:
    Help > Troubleshooting Information
    Alternately, you can try those sites with your add-ons disabled using Firefox's [http://support.mozilla.com/kb/Safe+Mode Safe Mode]. Use
    Help > Restart with Add-ons Disabled
    In the dialog, don't check any boxes, just click "Continue in Safe Mode." If the sites work as designed, then the most likely culprit is one of your add-ons.
    Does that help at all?

  • Adding javascript code into user actions assign task operation

    Hi all,
         I've a severe issue , i searched for a solution and nothing returned till my mind blown , i made a process and put a lot of assign task operations with user actions {"Approve","Reject"} what i want to do is when the user hits Reject action a pop-up window is opening to him to put his rejection reasons / justifications, till now i couldn't find a solution or an article writing about a solution for it, so your help is urgently required.
    Thanks in advance & have a nice day.

    Hi,                                                             
    It will not easy to add actions to an OOTB ribbon button, there is a workaround that we can replace it with a custom button.
    Here is a documentation about Replacing a Button on the Server Ribbon:
    http://msdn.microsoft.com/en-us/library/ff407619.aspx
    Another two links about create a custom ribbon button for your reference:
    http://msdn.microsoft.com/en-us/library/office/ff407458(v=office.14).aspx
    http://sharepoint.stackexchange.com/questions/20646/attach-a-javascript-function-to-an-ootb-ribbon-button
    Best regards
    Patrick Liang
    TechNet Community Support

  • IC_BASE, Page Fragments : root_content.htm adding custom code in standard .htm

    Hi All,
    I am adding custom code in Page Fragments : root_content.htm of bsp application : IC_BASE, for particular business purpose but after activating
    its asking to select page fragments. here its showing IC_BASE and etc.. could you pls guide me how to check which page fragment for this
    root_content.htm. and also i am adding custom code in mail.htm under page with flow logic of same bsp application. so here i am assuming page
    fragment is IC_BASE.
    Jimmi.

    Hi Jimmi,
    In General if you want to modify standard BSP component, you need to enhance the component first and then you need to enhance the particular view you want to modify. You can directly modify the .htm page in view after enhancement.
    Regards,
    Dharmakasi.

  • Javascript is not called in jsp page

    Hi,
    I have jsp page which actually redirect to another jsp page....
    I need to run some javascript code before redirecting to another page
    But it seems script got skipped & it goes to desired page
    code snippet:
    <%@ taglib uri="/ABCTaglib" prefix="AA" %><%response.setContentType("text/xml");%><AA:sitemap pagename="test" />
    <script type="text/javascript">
    alert("testing");
    </script
    String answerid = request.getParameter("answerid");
    String url = request.getParameter("url");
    response.sendRedirect(url);I am expecting an alert "testing" before redirect to another page.
    Thanks in advance

    Javascript is not java.
    Java/JSP runs on the server.
    javascript runs on the client, when the browser loads the page.
    As far as the server is concerned, all that javascript you have there is just template text to be echoed out in its response.
    A redirect will cancel the current response, and send a "redirect" response to tell the client where to go.
    Any output written to the response up until the redirect is discarded.
    If you want to pop up an alert, you actually have to return a response web page, with that javascript embedded in it, and then have that page navigate onwards to where you want to go (potentially using a meta refresh tag)

  • PrepareRender() called multiple times if I have HTML/Images on a JSF page

    I have extended ADFPhaseListener and also FacesPageLifecycle. I am overriding the prepareRender() method in the CustomFacesPageLifecycle.
    When I insert an image on to the page in the branding facet or add any html using verbatim tag, the prepareRender() method is called two times. I am not sure why?
    If I remove the images/html, the method is only executed once.
    If I have image/html in the page, another strange thing is that the first time all the custom lines of code gets executed in prepareRender() method. But the second time only first few lines of code in the prepareRender() method. This seems to me a very wierd behaviour.
    Any inputs from ADF product dev team?
    Thanks
    - Amit Kochar

    Hi,
    if you add the following print statement
    System.out.println("rendering "+FacesContext.getCurrentInstance().getViewRoot().getViewId());
    Then the output in my case is
    07/04/24 08:14:04 rendering /BrowsePage.jsp
    07/04/24 08:14:05 rendering /otn_logo_small.gif
    The image comes from the file system, which means it is rendered by the JSF lifecycle. If you reference the image with a URL then the lifecycle doesn't render the image but only refrences it.
    To avoid your prepare render code to be executed multiple times, just check for jsp and jspx file extensions, which will guarantee that your code only executes for JSF pages, not for loaded files.
    The reason why this happens is because the JSF filter is set to /faces , which means all files that are loaded through that path
    Frank

  • Add additional Javascript code on OOTB sharepoint ribbon button.

    Hello,
    We have SharePoint Ent and Project Server 2010 SP-2 environment.
    So the requirement is like that we have 1 OOTB "Save" ribbon button for Project Server 2010 Project Detail Pages. Which actually Saves and Publishes the project updates into Project Server database.
    Here I have to execute javascript code basically to refresh the page right after user click OOTB "Save" button and Projects gets saved into database.
    But here I am not getting any pointer how to add this additional Javascript code into commandaction of existing OOTB "Save" ribbon button, so that my Project gets save and publish and also I'll be able to refresh the page right after the save and
    publish.
    Please help me let me know how can i hook into OOTB SharePoint ribbon button actions.
    Thanks !!!
    Sachin Vashishth MCTS

    Hi,                                                             
    It will not easy to add actions to an OOTB ribbon button, there is a workaround that we can replace it with a custom button.
    Here is a documentation about Replacing a Button on the Server Ribbon:
    http://msdn.microsoft.com/en-us/library/ff407619.aspx
    Another two links about create a custom ribbon button for your reference:
    http://msdn.microsoft.com/en-us/library/office/ff407458(v=office.14).aspx
    http://sharepoint.stackexchange.com/questions/20646/attach-a-javascript-function-to-an-ootb-ribbon-button
    Best regards
    Patrick Liang
    TechNet Community Support

  • Javascript error in jsf page.

    Hi,
    I am trying to Do post form a script function in a jsf page. I am using the trh:script tag for adding the script. But when run it i am getting a lot of errors saying that the attributes cannot be recognised. I am trying to send a xml updated with some data after the click of a button to the server. Though its not showing any any errors when not run.
    Below is the code i am using :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
    <%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
    <%@ taglib uri="http://xmlns.oracle.com/dss/trinidad/faces" prefix="dvtt"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%>
    <f:view>
    <trh:script text="
    var endpointURL = "http://localhost:7101/services/MobileManagerService";
    var xmlstring = '<?xml version="1.0"encoding="UTF-8"?>\
    <notifications>\
         <notification>\
              <id>1<\/id>\
                   <status>CLOSE<\/status>\               
              <\/notification>\
         <\/notifications>';
    var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");
    var stautsXml = (new XMLSerializer()).serializeToString(xmlobject);
    alert(stautsXml);
    var http_request = false;
    function makePOSTRequest(method, url, parameters) {
    http_request = false;
    if(window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
    // Set type accordingly to anticipated content type.
    http_request.overrideMimeType('text/xml');
    // http_request.overrideMimeType('text/html');
    } else if (window.ActiveXObject) { // IE
    try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
    if (!http_request) {
    alert('Cannot create XMLHttpRequest object');
    return false;
    http_request.onreadystatechange = alertContents;
    // http_request.open(method, url, true);
    if(method=='GET'){
    http_request.open(method, url + parameters, true);
    http_request.setRequestHeader("Content-type", "text/xml");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(null);
    if(method=='POST') {
    http_request.open(method, url, true);
    http_request.setRequestHeader("Content-type", "text/xml");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(parameters);
    if(method=='PUT') {
    http_request.open(method, url, true);
    http_request.setRequestHeader("Content-type", "text/xml");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(parameters);
    if(method=='DELETE') {
    http_request.open(method, url+parameters, true);
    http_request.setRequestHeader("Content-type", "text/xml");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(null);
    function alertContents() {
    if (http_request.readyState == 4) {
    if (http_request.status == 200) {
    alert('Response received from server:\n'+http_request.responseText);
    result = http_request.responseText;
    // Turn < and > into &lt; and &gt; for displaying on the page.
    result = result.replace(/\<([^!])/g, '&lt;$1');
    result = result.replace(/([^-])\>/g, '$1&gt;');
    document.getElementById('serverresponse').innerHTML = result;
    } else {
    alert('There was a problem with the request.'
    +http_request.responseText +' '+http_request.status);
    document.getElementById('serverresponse').innerHTML = http_request.responseText;
    function postApproveForm() {
    var poststr = stautsXml ;
    alert('Sending XML to server:\n'+poststr);
    makePOSTRequest('POST', endpointURL , poststr);
    "/>
    <trh:html id="h2">
    <trh:head title="ApproveAlerts" id="h1">
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    <link type="text/css" rel="stylesheet" href="css/iPhone.css"/>
    </trh:head>
    <trh:body id="b1">
    <!-- <jsp:useBean id="IdBean" class="oracle.application.IdBean" scope="application"/> -->
    <af:messages id="m1"/>
    <trh:body styleClass="body" id="b2">
    <!-- <td><input type="button" name="Approve" value="Approve" onclick="javascript:approveAlert();"></td> -->
    <td>
    <input type="button" name="Approve" value="Approve" onclick="postApproveform();" </input>
    </td>
    <af:outputText id="ot1" value='"#{requestScope.myId}"'/>
    </trh:body>
    </trh:body>
    </trh:html>
    </f:view>
    Do i need to add some taglib or something to make it work ?
    Regards
    Sishant
    Edited by: user784337 on May 24, 2010 3:37 AM

    Because :
    Session.getAtrribute is java-code that can only run on the server
    and
    var y = session.getAttribute is javascript-code run on the client.

  • Javascript code to enable an ADD button to create duplicate tables and pages for multiple entries

    I am using Adobe XI Pro. I have created a multi-page fillable pdf questionnaire that I want to make interactive to the user. Within each page, I have multiple tables that can have ADD buttons to duplicate the table if the client wants more than one test. I would like this table to insert directly below the previous table and they may be able to add upto 5 of these table.
    I also have a couple pages in the questionnaire that require duplication for multiple samples. Eg. One page per sample, and I may have upto 10 samples. I would like the javascript to have an ADD button and then add each page behind the previous related sheet (Original and duplicates together)
    I am not a javascript coder so I would need some examples and a walk through. I did take some developer courses in engineering but it has been almost two decades
    I have search on several forums and cannot find a good resource so I appreciate the help.
    Sincerely
    Tara

    Some of what you want to do can be done using template features and a bit of JavaScript, but if your users will be using Reader, version 11 will be required. You can dynamically add new pages, but adding new tables to existing pages with reflow of content that comes after is not possible with a form created in Acrobat. If you have access to Adobe's LiveCycle Designer form creation software, you can create what's known as a dynamic XFA form that can do all of what you want. You can ask in the LiveCycle Designer forum for more information: http://forums.adobe.com/community/livecycle/livecycle_modules_and_development_tools/livecy cle_designer_es?view=discussions

  • Malicious Javascript code added to the bottom of my HTML

    Hello,
    Below is the code to my main page, called index.php.  It is what shows when I type my domain into the browser.  On a few occasions, when I open it in Internet Explorer, some malicious javascript code has been added to the bottom of the code.  The malicious javascript code looks like: "<script type="text/javascript">eval(String.fromCharCode(118,97,114,32,120,101,119,61,57,56,55,49, 51,49,..."
    It seems like this code then installs a fake anti-virus program on the computer of anyone who visits my site.  How can I prevent this malicious javascript from getting written into my source code?
    Thanks,
    John
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <?php
    session_start();
    unset($_SESSION['find']);
    ?>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="tablestyles.css">
    </head>
    <body>
    <div class="mainlinks"><a href="about.php" class="links">About</a><a href="testpage.php" class="links">New Testpage</a><a href="tablecreate.php" class="links">Table Create</a></div>
    <div class="line"></div>
    <div class="smalllogo"><a href="index.php"><img src="images/logo.png" alt="Tywod" width="170" height="45" border="0"/></a></div>
      <div class="searchbox">
      <form action="tsearch14.php" method="post">
      <label>Enter Topic:
      <input type="text" name="find" size="55"/>
      <input type="hidden" name="searching" value="yes" />
      <input type="submit" name="search" value="Search" />
      </label>
      </form>
      </div>
    <div class="line2"></div>
    <div class="copyright">©2009 Title</div>
    </body>
    </html>

    You may find this blog post valuable!
    http://blog.cartweaver.com/index.cfm?newsid=56
    Lawrence   *Adobe Community Expert*
    www.Cartweaver.com
    Complete Shopping Cart Application for
    Dreamweaver, available in ASP, PHP and CF

  • How to add html/javascript code to all my pages at once

    dear adobers,
    i want to add a javascript code that records my site's visitor count, but in order to do that i have to place it on every single page...so, is there a way i can do that externally like adding it in my style.css or something else that saves time ? please help

     or ⌘ key
    http://en.wikipedia.org/wiki/Command_key#The_origin_of_.22.E2.8C.98.22 - command key (Wikipedia)

  • How to use ocx with javascript in jsf page

    Hello,
    Please i create a jsf page which purpose is to scan.
    I used in a source of my jsf page an OCX with object tag like
    <OBJECT ID="Ranger"
    CLASSID="CLSID:1C5C9095-05A8-11D4-9AF9-00104B23E2B1">
    </OBJECT>
    i wrote my functions which use this ocx in javascript. Function that i call with clientlistener rear adf button
    but it doesn't work
    Could you please help me please VERY IMPORTANT

    This my html code:
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportNewState(newState,previousState)>  
    // Transport new state, fired every time the State changes on the control
    // input params , are the new state and the previous state
    //alert(newState);
    var RangerTransportStates = {TransportUnknownState: -1, TransportShutDown: 0, TransportStartingUp: 1,
                                  TransportChangeOptions: 2, TransportEnablingOptions: 3, TransportReadyToFeed: 4,
                                  TransportFeeding: 5, TransportExceptionInProgress:6, TransportShuttingDown: 7};
    if(newState == RangerTransportStates.TransportShutDown)
          document.getElementById('StartRanger').disabled = false;
          document.getElementById('EnableRanger').disabled = true;
          document.getElementById('StopFeeding').disabled = true;
          document.getElementById('StartFeeding').disabled = true;
          document.getElementById('ChangeOptions').disabled = true;
          document.getElementById('Shutdown').disabled = true;     
          document.getElementById('UserInstructions').innerHTML = "Press 'Startup Ranger' to initialize the Ranger control"
    if(newState == RangerTransportStates.TransportChangeOptions)
          document.getElementById('StartRanger').disabled = true;
          document.getElementById('StartFeeding').disabled = true;
          document.getElementById('EnableRanger').disabled = false;
          document.getElementById('Shutdown').disabled = false;
          document.getElementById('UserInstructions').innerHTML = "<b>Ranger Started</b> <br> Press 'Enable Ranger' to enable the current Ranger Options and prepare to start feeding"
    if(newState == RangerTransportStates.TransportReadyToFeed)
          document.getElementById('EnableRanger').disabled = true;
          document.getElementById('StopFeeding').disabled = true;
          document.getElementById('StartFeeding').disabled = false;
          document.getElementById('ChangeOptions').disabled = false;
          document.getElementById('Shutdown').disabled = false;
          document.getElementById('UserInstructions').innerHTML = "<b>Ready to feed </b><br> Press 'Start Feeding' to start Ranger Feeding checks from main hopper"
    if(newState == RangerTransportStates.TransportFeeding)
          document.getElementById('StartFeeding').disabled = true;
          document.getElementById('ChangeOptions').disabled = true;
          document.getElementById('Shutdown').disabled = true;
          document.getElementById('StopFeeding').disabled = false;     
          document.getElementById('UserInstructions').innerHTML = "<b>Feeding... </b><br> Press 'Stop Feeding' to stop Ranger from Feeding checks"
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportChangeOptionsState(previousState)>  
    //Fired when Ranger reaches the change option state, input params are previous state
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportReadyToFeedState(previousState)>  
    //Fired when ranger is ready to feed the next item
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportFeedingStopped(reason,itemsFed,itemsrequested)>  
    //Fired when feeding has stopped
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportItemInPocket(itemID)>  
    //Fired when the item has been fed into the pocket
    var RangerSides = {TransportFront: 0, TransportRear: 1};
    var RangerImageColorTypes = {ImageColorTypeBitonal:0, ImageColorTypeGrayscale: 1, ImageColorTypeColor: 2};
    // Note: SaveImageToFile() below is used to save gray scale images.  Please verify that 'NeedFrontImage2' and
    //       'NeedRearImage2' are set to 'true' in the GenericOptions.ini file.  If bitonal images are to be saved,
    //       please set 'NeedFrontImage1'/'NeedRearImage1' to 'true' before calling SaveImageToFile() for bitonal images.
    document.getElementById('MICR').innerHTML = 'MICR: ' + Ranger.GetMicrText(1);
    temp = Ranger.SaveImageToFile(RangerSides.TransportFront, RangerImageColorTypes.ImageColorTypeGrayscale, "C:\\test\\Testfront.jpg");
    temp = Ranger.SaveImageToFile(RangerSides.TransportRear, RangerImageColorTypes.ImageColorTypeGrayscale,"C:\\test\\Testback.jpg");
    //Here you could check to see if the images were saved, putting alternate
    //text in place of the image if they werent saved.
    document.getElementById('PIC').innerHTML = '<img height=200 width=400 src=' + '"Testfront.jpg">' + '<br>' + '<img height=200 width=400 src=' + '"Testback.jpg">';
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportNewItem()>  
    // Fired when a new item has entered the track
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportShutDownState(currentState,previousState)>  
    //Fired when the Ranger control has been shutdown
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportSetItemOutput(itemID)>  
    //fired when the item is ready to have params set(pocketing decisions)
    getstatus();
    </SCRIPT> 
    <!-- End of Events ------------- -->
    <SCRIPT LANGUAGE="javascript">
    function getstatus()
         document.getElementById('Status').innerHTML = 'Status: ' + Ranger.GetTransportStateString();
    </SCRIPT>
    </head>
    <body>
    <OBJECT ID="Ranger"
    CLASSID="CLSID:1C5C9095-05A8-11D4-9AF9-00104B23E2B1">
    </OBJECT>
    <div id="container">
         <div id="banner" >
         </div>
         <div id="left">
              <h2>Ranger Control Buttons</h2>
              <br><div id="Status">Status:</div><br>
              <input class="controlbutton" id="StartRanger" type=button value="Startup Ranger" onclick="Ranger.Startup();">
              <input class="controlbutton" id="EnableRanger" disabled type=button value="Enable Ranger" onclick="Ranger.EnableOptions();">
              <input class="controlbutton" id="StartFeeding" disabled type=button value="Start Feeding" onclick="Ranger.StartFeeding(0,0);">
              <input class="controlbutton" id="StopFeeding" disabled type=button value="Stop Feeding" onclick="Ranger.StopFeeding();">
              <input class="controlbutton" id="ChangeOptions" disabled type=button value="Change Options" onclick="Ranger.PrepareToChangeOptions();">
              <input class="controlbutton" id="Shutdown" disabled type=button value="Shutdown Ranger" onclick="Ranger.Shutdown();">
         </div>
         <div id="content">
              <div id="UserInstructions">Press 'Startup Ranger' to initialize the Ranger control</div>
              <br>
              <div id="MICR"></div>
              <br>
              <div id="PIC"></div>
         </div>
         <div id="footer"><h1>Ranger Control</h1></div>
    </div>
    them jsf code:
    <f:view>
    <OBJECT ID="Ranger"
        CLASSID="CLSID:1C5C9095-05A8-11D4-9AF9-00104B23E2B1">
    </OBJECT>   
      <af:document id="d1" title="Fiche Bordereau">
        <af:messages id="m1"/>
        <af:form id="f1">
          <af:pageTemplate viewId="/tempCompens.jspx" id="pt1">
           <af:resource type="javascript">
            // Transport new state, fired every time the State changes on the control
            // input params , are the new state and the previous state
            //alert(newState);
            var RangerTransportStates = {TransportUnknownState: -1, TransportShutDown: 0, TransportStartingUp: 1,
                                  TransportChangeOptions: 2, TransportEnablingOptions: 3, TransportReadyToFeed: 4,
                                  TransportFeeding: 5, TransportExceptionInProgress:6, TransportShuttingDown: 7};
            ok =false;
            var i = 0;
            if(newState == RangerTransportStates.TransportShutDown)
                document.getElementById('btn_demarre').disabled = false;
                document.getElementById('btn_active').disabled = true;
                document.getElementById('btn_arretscan').disabled = true;
                document.getElementById('btn_scan').disabled = true;
                document.getElementById('btn_changetat').disabled = true;
                document.getElementById('btn_arret').disabled = true;
                document.getElementById('UserInstructions').value = "Appuyer sur Demarrer pour initiliser le scanner"
            if(newState == RangerTransportStates.TransportChangeOptions)
                document.getElementById('btn_demarre').disabled = true;
                document.getElementById('btn_scan').disabled = true;
                document.getElementById('btn_active').disabled = false;
                document.getElementById('btn_arret').disabled = false;
                document.getElementById('UserInstructions').value = "Demarrage... Appuyer sur Activer pour preparer le scanning "
                ok = false;
            if(newState == RangerTransportStates.TransportReadyToFeed)
                document.getElementById('btn_active').disabled = true;
                document.getElementById('btn_arretscan').disabled = true;
                document.getElementById('btn_scan').disabled = false;
                document.getElementById('btn_changetat').disabled = false;
                document.getElementById('btn_arret').disabled = false;
                document.getElementById('UserInstructions').value = "Pret a scanner.   Appuyer sur Scanner pour lancer le scanning"
                ok = true;
            if(newState == RangerTransportStates.TransportFeeding)
                document.getElementById('btn_scan').disabled = true;
                document.getElementById('btn_changetat').disabled = true;
                document.getElementById('btn_arret').disabled = true;
                document.getElementById('btn_arretscan').disabled = false;
                document.getElementById('UserInstructions').value = "Scanning...  Appuyer sur Arret scanning pour stopper le scanning"
            getstatus();
           </af:resource>
           <af:resource type="javascript">
            //Fired when the item has been fed into the pocket
                var RangerSides = {TransportFront: 0, TransportRear: 1};
                var RangerImageColorTypes = {ImageColorTypeBitonal:0, ImageColorTypeGrayscale: 1, ImageColorTypeColor: 2};
            //alert(Ranger.GetGenericOptionFileName());
                Ranger.SetGenericOption("OptionalDevice","NeedFrontImage1",true);
                Ranger.SetGenericOption("OptionalDevice","NeedRearImage1",true);
                document.getElementById('cmc7').value = 'CMC7= '+Ranger.GetMicrText(1);
                var cmc7 = trim(Ranger.GetMicrText(1));
                cmc7 = cmc7.replace(" ","_");
                cmc7 = cmc7.replace(" ","_");
            //cmc7 = cmc7.substring(0,15);
                cmc7R = cmc7+"_R.jpg";
            //alert(Ranger.GetImageAddress(RangerSides.TransportFront, RangerImageColorTypes.ImageColorTypeGrayscale))
                function trim(myString)
                    return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
                temp = Ranger.SaveImageToFile(RangerSides.TransportFront, RangerImageColorTypes.ImageColorTypeGrayscale, "C:\\Documents and Settings\\Koffi Ernest\\Mes documents\\NetBeansProjects\\Scan-project\\web\\"+cmc7R);
                window.onload = function()
                  document.getElementById("verso").src = monfichierV();
                function monfichierR()
                //  nomfichier = nomfichier+"_R.jpg";
                    var nomfichier = trim(Ranger.GetMicrText(1))+"_R.jpg";
                    return  nomfichier
                cmc7V = cmc7+"_V.jpg";
                temp = Ranger.SaveImageToFile(RangerSides.TransportRear, RangerImageColorTypes.ImageColorTypeGrayscale,"C:\\Documents and Settings\\Koffi Ernest\\Mes documents\\NetBeansProjects\\Scan-project\\web\\"+cmc7V);
                window.onload = function()
                    document.getElementById("verso").src = monfichierV();
                function monfichierV()
                    var nomfichierV = trim(Ranger.GetMicrText(1))+"_V.jpg";
                    return nomfichierV
                function getRImageUrl(img)
                    var imageSrc = trim(Ranger.GetMicrText(1))+"_R.jpg";
                    if(img.src != imageSrc)
                    // don't get stuck in an endless loop
                    img.src = imageSrc;
                function getVImageUrl(img)
                 var imageSrc = trim(Ranger.GetMicrText(1))+"_V.jpg";
                 if(img.src != imageSrc)
                 { // don't get stuck in an endless loop
                  img.src = imageSrc;
            document.getElementById('recto').source = cmc7R;
            document.getElementById('verso').source = cmc7V;
            getstatus();
           </af:resource>
            <af:resource type="javascript">
                 document.getElementById('status').value = Ranger.GetTransportStateString();
            </af:resource>
            <f:facet name="temp">
              <af:panelSplitter id="ps1" splitterPosition="329"
                                inlineStyle="width:709px;">
                <f:facet name="first">
                  <af:panelGroupLayout layout="scroll"
                                       xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                                       id="pgl5">
                    <af:panelGroupLayout id="pgl1">
                      <af:outputText value="Saisie des informations du bordereau"
                                     id="ot1"
                                     inlineStyle="font-size:small; font-family:inherit; color:Gray; font-weight:bold;"/>
                    </af:panelGroupLayout>
                    <af:panelFormLayout id="pfl1">
                      <f:facet name="footer">
                        <af:panelGroupLayout id="pgl4" layout="horizontal">
                          <af:commandButton text="Annuler" id="cb4"/>
                          <af:spacer width="5" height="10" id="s14"/>
                          <af:commandButton text="Scanner" id="cb5"
                                            action="success"/>
                        </af:panelGroupLayout>
                      </f:facet>
                      <af:spacer width="10" height="30" id="s2"/>
                      <af:panelGroupLayout id="panelGroupLayout1"
                                           layout="horizontal" valign="middle">
                        <af:inputText label="N° de compte                   " id="it1"/>
                        <af:spacer width="10" height="10" id="s16"/>
                        <af:commandButton text="..." id="cb3"/>
                      </af:panelGroupLayout>
                      <af:spacer width="5" height="3" id="s12"/>
                      <af:panelGroupLayout id="pgl2" layout="horizontal"
                                           valign="middle">
                        <af:inputText label="Nom du client         " id="it3"/>
                      </af:panelGroupLayout>
                      <af:spacer width="5" height="3" id="s17"/>
                      <af:panelGroupLayout id="pgl11" layout="horizontal"
                                           valign="middle">
                        <af:inputText label="N° bordereau    " id="it4"/>
                        <af:spacer width="5" height="10" id="s11"/>
                        <af:commandButton text="New" id="cb1"/>
                        <af:spacer width="2" height="10" id="s13"/>
                        <af:commandButton text="Find" id="cb2"/>
                      </af:panelGroupLayout>
                      <af:spacer width="5" height="3" id="s18"/>
                      <af:panelGroupLayout id="pgl3">
                        <af:inputText label="Nbre de chèque" id="it2"/>
                        <af:spacer width="5" height="3" id="s19"/>
                        <af:inputDate label="Date d'operation                  " id="id1"/>
                      </af:panelGroupLayout>
                      <af:spacer width="1000" height="10" id="s1"/>
                    </af:panelFormLayout>
                  </af:panelGroupLayout>
                </f:facet>
                <f:facet name="second">
                  <af:panelGroupLayout layout="scroll"
                                       xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                                       id="pgl6">
                    <af:outputText value="Resultat scanning" id="ot2"
                                   inlineStyle="font-size:small; font-weight:bold; color:Gray;"/>
                    <af:panelTabbed id="pt2"
                                    inlineStyle="height:498px; width:680px;">
                      <af:showDetailItem text="Scanning" id="sdi1">
                        <af:panelSplitter id="ps2" splitterPosition="103"
                                          inlineStyle="width:433px; height:436px;">
                          <f:facet name="first">
                            <af:panelGroupLayout id="pgl7" layout="vertical">
                              <af:outputText value="Liste de contrôles" id="ot3"
                                             inlineStyle="font-weight:bold; color:Gray;"/>
                              <af:spacer width="10" height="10" id="s20"/>
                              <af:outputText id="status"/>
                              <af:spacer width="10" height="10" id="s8"/>
                              <af:commandButton text="Demarrer      "
                                                id="btn_demarre">
                                <af:clientListener type="click"
                                                   method="Ranger.Startup()"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s7"/>
                              <af:commandButton text="Activer              "
                                                id="btn_active"
                                                disabled="true">
                                <af:clientListener method="Ranger.EnableOptions()"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s6"/>
                              <af:commandButton text="Scanner       "
                                                id="btn_scanne"
                                                disabled="true">
                                <af:clientListener method="Ranger.StartFeeding(0,0)"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s3"/>
                              <af:commandButton text="Arrêt Scan   "
                                                id="btn_arretscan"
                                                disabled="true">
                                <af:clientListener method="Ranger.StopFeeding()"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s4"/>
                              <af:commandButton text="Changer Etat"
                                                id="btn_changetat"
                                                disabled="true">
                                <af:clientListener method="Ranger.PrepareToChangeOptions()"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s5"/>
                              <af:commandButton text="Arrêter         "
                                                id="btn_arret"
                                                disabled="true">
                                <af:clientListener method="Ranger.Shutdown()"
                                                   type="click"/>
                              </af:commandButton>
                            </af:panelGroupLayout>
                          </f:facet>
    ....Edited by: nesta on 21 juil. 2010 07:07

  • Can JSF generates a javaScript Code ???

    Hello guys,
    Can a JSF or JSP generates a javaScript code for validating a text field
    like ASP.NET ?
    So, that there is no need to go to the server to check (e.g.) if it is required or not !
    Regards

    http://www.jroller.com/page/cagataycivici?entry=jsf_client_side_validators

  • Problem with JavaScript code in Page Attributes, modal popup...

    Hello all!
    I'm encountering a problem with a modal popup I wrote in JavaScript.
    h3.
    The situation*
    A user sees an interactive report with rows that are clickable, so these rows are links. Upon clicking the name of something in a row, some items get a certain value and a modal popup shows on the screen. In this modal popup, there are details regarding that particular row the user has clicked, but the problem_ here is...
    The modal popup closes itself only seconds after it has been opened.
    This must be because I've probably made a mistake somewhere in my code, but I just can't figure out where... It also appears that when I click on a row link, the popup shows, but the progress bar of my toolbar seems to show a loading bar (as if I refreshed the page).
    h3.
    My code*
    This code is located in the _"Function and Global Variable Declaration"_ part, under the _"JavaScript"_ tab. Code is in the _"Page Attributes"_ of my page 24.
    function showhide(x){
    $x('REGION1').style.display = ( x == 'REGION1') ? 'block' : 'none';
    $x('REGION2').style.display = ( x == 'REGION2') ? 'block' : 'none';
    $x('REGION3').style.display = ( x == 'REGION3') ? 'block' : 'none';
    $( function(){
      $('#ModalForm').dialog(
         modal: true,
         autoOpen: false,
         width: 500,
         height: 350,
         buttons:{ Close: function(){closeForm();}        
    function openForm()
        $('#ModalForm').dialog('open');
    function closeForm()
        $('#ModalForm').dialog('close');
        $(document).ready(function() {
            $('a.temppop').click(function() {
                openForm();
        });This code is located in the _"Header Text"_ part, under the _"Header"_ tab. Code is in the _"Page Attributes"_ of my page 24.
    <link rel="stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"> </script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"> </script>This code is located in the _"Column Link"_ part, you get there by going to the _"Report Attributes"_ of the region called _"Template overview"_ on page 24. This region is an interactive report.
    Link Text: #FOODTEMPLATENAME#
    Link Attributes: class="temppop"
    Target: Page in this Application
    Page: 24
    Item 1, name: P24_MEALID; item 1, value: #MEALTYPEID#
    Item 2, name: P24_TEMPLATEID; item 2, value: #FOODTEMPLATEID#So basically I call the function to open the modal popup by the class name. When a link with that class name in it is clicked, it opens the popup.
    To remind you of the problem, the modal popup closes seconds after it has been opened. How do I fix this?
    Thanks in advance.
    (APEX version 4.1.1.00.23)

    Come on guys... I really need to know this. :(

  • After adding a flashfile .swf into a dreamweaver page and trying to run it, I get an error message related to Javascript

    after adding a flashfile .swf into a dreamweaver page and trying to run it, I get an error message related to Javascript
    I have no trouble viewing other websites with (most likely), flashfiles.
    Here is the the PopUp message:
    "Adobe-warning Adobe Flash PLayer has stopped a potentrially unsafe operation......"

    In newer versions of Flash Pro, you can export to HTML5 Canvas, that's probably what they're talking about: Flash Professional Help | Creating and publishing an HTML5 Canvas document
    .FLV and .SWF are Flash formats that won't show up on iOS (or an ever increasing number of other mobile devices). Mobile Flash was killed by Adobe a couple years ago, so the number of mobile devices that can see it is dwindling rapidly, don't use those formats if you want your viewers on mobile devices to see your content.

Maybe you are looking for