I18n in javascript, anybody?

i have a jsp page in which i also include a .js file.
now i want to internationalize the javascript code as well as jsp code.
but if the jsp is parsed before the .js file is inlcuded then how do i use the i18n message tag in my javascript code??

Yes, I struggled with something similar, so I wrote an i18n library for JavaScript. It shares properties files with Java, gets them from the server via Ajax, and also provides currency, calendar and other features. Check it out at http://jsorm.com. GPL-released, so enjoy.

Similar Messages

  • Control Symbol through keycode

    Hi
    I want to control Symbol through keycode (keyboard shortcuts in Javascript)
    anybody knows pls help me on this
    Thanks,
    Pramod

    Hi there, keycode functionality is not built into Edge, but since Edge runs on javascript, you can use regular javascript to listen to the user's keyboard inputs, then you can compare those inputs to whatever keyCodes you want, and within a switch statement react accordingly.
    Below is an example, using jQuery.
    Example:
    http://www.timjaramillo.com/code/edge/keyCodes/
    Source:
    www.timjaramillo.com/code/edge/_source/keyCodes.zip
    Code on Stage.compositionReady:
    $(document).keydown(
              function(e) {
                        // prevent any default actions
                        e.preventDefault();
       // test- show keycode in text
                        sym.$("test").html('keyCode: '+e.keyCode);
                        switch( e.keyCode ) {
                                  // example: handle arrow keys
                                  case 37:
                                            break;
                                  case 38:
                                            break;
                                  case 39:
                                            break;
                                  case 40:
                                            break;

  • A Problem with the JavaScript Code can anybody help me

    Hi every body,
    I prepared a html page using the following code, which i grab it from some web site, and used it in my web project,
    but the code that is not working and it is showing some javascript error, can anybody correct it for me please, the code is as follows
    <html>
    <head>
    <title>Contact Form</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    // CSS goes here
    </style>
    <script language="JavaScript">
    function checkForm()
       var cname, cemail, csubject, cmessage;
       with(window.document.msgform)
          cname    = sname;
          cemail   = email;
          csubject = subject;
          cmessage = message;
       if(trim(cname.value) == '')
          alert('Please enter your name');
          cname.focus();
          return false;
       else if(trim(cemail.value) == '')
          alert('Please enter your email');
          cemail.focus();
          return false;
       else if(!isEmail(trim(cemail.value)))
          alert('Email address is not valid');
          cemail.focus();
          return false;
       else if(trim(csubject.value) == '')
          alert('Please enter message subject');
          csubject.focus();
          return false;
       else if(trim(cmessage.value) == '')
          alert('Please enter your message');
          cmessage.focus();
          return false;
       else
          cname.value    = trim(cname.value);
          cemail.value   = trim(cemail.value);
          csubject.value = trim(csubject.value);
          cmessage.value = trim(cmessage.value);
          return true;
    function trim(str)
       return str.replace(/^\s+|\s+$/g,'');
    function isEmail(str)
       var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|
    ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|
    bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|
    ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|
    dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|
    gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|
    hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|
    kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|
    ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|
    mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|
    nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|
    re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|
    su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|
    ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|
    zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
    </script>
    </head>
    <body>
    <form method="post" name="msgform">
    <table width="500" border="0" align="center" cellpadding="2" cellspacing="1" class="maincell">
    <tr>
    <td width="106">Your Name</td>
    <td width="381"><input name="sname" type="text" class="box" id="sname" size="30"></td>
    </tr>
    <tr>
    <td>Your Email</td>
    <td>
    <input name="email" type="text" class="box" id="email" size="30">
    </td></tr>
    <tr>
    <td>Subject</td>
    <td><input name="subject" type="text" class="box" id="subject" size="30"></td>
    </tr>
    <tr>
    <td>Message</td>
    <td><textarea name="message" cols="55" rows="10" wrap="OFF" class="box" id="message"></textarea></td>
    </tr>
    <tr align="center">
    <td colspan="2"><input name="send" type="submit" class="bluebox" id="send" value="Send Message" onClick="return checkForm();"></td>
    </tr>
    <tr align="center">
    <td colspan="2"> </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    function isEmail(str)
       var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|
    ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|
    bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|
    ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|
    dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|
    gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|
    hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|
    kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|
    ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|
    mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|
    nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|
    re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|
    su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|
    ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|
    zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
    Remove all enter sequences inbetween lines in the above function. It vl work.
    All d Best :-)

  • How to put a javascript  variable containg the i18n key  in the i18n tag

    I have a list of values in a List box.when the user selects a praticular value.,i need to show the java script localized alert message for the selected value.
    how can i pass the javascript variable to i18n tag.
    For ex:
    function test(){
    var selectedvalue='name';
    var localizedstring='<i18n:message key="+selectedvalue+"/>';--This is not working
    alert('<i18n:message key="+selectedvalue+"/>');
    the alert message is a blank string,even though i have the key in my resource bundle.
    Also..if i give directly pass the key value to i18n string it works. like..
    var localizedstring='<i18n:message key="+name+"/>';--This is  working
    *(am passing the variable value)*

    The following should be able to pass ans.
    <script language="Javascript">
    function check_answer(ans) {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
    %>jag

  • Javascript in JSP Portlet error..can anybody help?

    Hi..
    I got a problem..
    I use JSP in Portlet..
    The problem is, when i put this code in Portlet, it gaves me javascript Error..not sure what to do...
    'document.standinglist._piref1_41281_1_1.next_page' is null or not an object '
    In normal situation (jsp in server, not in portlet)..it is ok..
    function cancelR(flag) {
    var total = 0;
    if ( confirm("Do you want to continue process this record ?") ) {
    document.standinglist._piref1_41281_1_1.next_page.value = "/htdocs/stand/standcancel.jsp?flag=flag";
    document.standinglist.submit();
    else {
    alert("Please select the required record!");
    }

    Hi,
    The behavior that you are seeing is an expected one. As i can understand, you have an HTML form element whose name is a fully qualified parameter & currently at runtime it is _piref1_41281_1_1.next_page If you carefully observe this, this name itself contains a period (dot).Hence when the browser tries to execute this, it thinks that _piref1_41281_1_1 is an object (which it isn't).
    The whole issue is because there is a dot in the fully qualified name which has this format _piref<portletInstanceRefId>.<ParamName>
    You could do the following to get it work. Use the following,
    document.standinglist.elements["._piref1_41281_1_1.next_page"].value = "/htdocs/stand/standcancel.jsp?flag=flag";
    Note however that this method call will not work on portal 3.0.9. when viewed using IE. This is due to IE's bizzare handling of this javascript call.
    Since, you are using Portal 9.0.2, you should not face any issues.
    Hope this helps.
    Regards,
    Abhinav

  • Does anybody have a workable exemple of JavaScript to open windows

    Hello I have been trying to use Javascript to open a window
    with no toolbar and resizeable with no success. Does any you have
    an exemple that has worked for this. I tried the following code:
    MM_openBrWindow('
    http://www.mrperezonlinemathtutor.com/GEOFLASH/3_1_Similar_Triangles.pps.swf','','width=80 0,height=600,resizable=1');
    and including the following function in the Page that opens
    the captivate 2 quiz, placed between the two head tags just after
    the title tag:
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
    return false;
    }//-->
    </script>

    Hello shperez.
    Here is a JavaScript that works well for me.
    void window.open('file.html','myWin','width=300, height=300,
    top=300, left=500, toolbar=1, menubar=1, location=1, status=1,
    scrollbars=1, resizable=1')
    Let me explain a few things. The 'myWin' is just naming your
    new window, in case you may have more than one button or click box
    that opens a new window. Gives it a unique name. It does not put
    that name at the top of the new browser window.
    The properties from toolbar to resizable can be either 1's or
    0's. 1's mean Yes I want that feature and 0's mean No. Also, if you
    don't want your window to have a property, it is not necessary to
    declare it with a false value, just leave it out.
    The void at the beginning of the code is to prevent the text
    [Object] being written in the main window, as a result of the
    open() method being directly invoked from the HREF attribute.
    When you place the code on a button or click box, just type
    it as above without putting in javascript:.
    You will have to publish and place it on your server to see
    it work. Javascript running on a PC invokes error messages or
    blocks off malicious code being run.
    Play around with the code to get the type window you want.
    Regards,

  • Convergence - i18n javascript error

    I set "i18nEnabled: true" in config.js, and add my changes to allDomain/nls/resources.js
    However, I see a javascript error in IE that is preventing Convergence from loading. It is trying to load en/resources.js, which doesn't exist. FireFox seems to be more lenient, and only reports the error but continues to load the client.
    If I change the preferred language to German, it errors out on de/resources.js.
    Do I need to go through and backfill a blank resources.js file for each language? Or is there a more elegant solution?

    jessethompson wrote:
    I set "i18nEnabled: true" in config.js, and add my changes to allDomain/nls/resources.js
    However, I see a javascript error in IE that is preventing Convergence from loading. It is trying to load en/resources.js, which doesn't exist. FireFox seems to be more lenient, and only reports the error but continues to load the client.
    If I change the preferred language to German, it errors out on de/resources.js.
    Do I need to go through and backfill a blank resources.js file for each language? Or is there a more elegant solution?There is a known issue with regards to the requirement to have "allDomain/nls/resources.js" :
    http://wikis.sun.com/display/CommSuite6/Convergence+1.0+Release+Notes#Convergence1.0ReleaseNotes-KnownIssues%3ACustomization
    This however is the opposite to what you are observing.
    I'm using the sample c11n allDomain files and don't see the behaviour you are reporting:
    bash-3.00# ls /opt/SUNWappserver/domains/domain1/docroot/iwc_static/c11n/allDomain/nls
    resources.jsFirefox reports an error trying to load http://server.aus.sun.com/iwc_static/c11n/allDomain/nls/en/resources.js?501_202951 however this doesn't prevent IE7 from loading.
    Are you sure there isn't a syntax error in your "allDomain/nls/resources.js" file e.g. a trailing comma?
    Regards,
    Shane.

  • Can anybody get JavaScript debugging working?

    Hi,
    I'm trying to get JavaScript debugging working. I think I followed the instructions in section 17.3.3 of the developer's guide. Then I start the application in the simulator and visit http://localhost:9999/ in my Chrome browser. I do get a "debug homepage" listing two links but when I click on these I get an debug console without any content. See the two screenshots below:
    https://docs.google.com/open?id=0B0EvDYuyTjZzYzN1cVJfdkNjZlk
    https://docs.google.com/open?id=0B0EvDYuyTjZzRGVmX0JadWppakk
    Am I doing something wrong or is this feature not complete?

    Great. That did the trick. In the meanwhile I setup weinre myself and that worked great in all webkit browsers, including chrome.
    Now that I've seen the default ADF setup work with Safari, I'll guess I stick with this bundled ADF setup for convenience

  • Using JavaScript & Dynamic Lists - ?? need help

    Hello all! Sorry to post this under an unrelated topic (JSP & JSTL), but there wasn't a JavaScript forum.
    Anyway, before I ask my questions...read the following:
    You'll find the code for my example at the end of this post. Also, I've posted my code as html pages in here...but my original code was in the form of servlets.
    Here's what I wanted to accomplish:
    1) html page has a form with two select lists
    2) select one option from the first select
    3) javascript code takes care of populating the 2nd list with options stored in an array, based on the first selection made in the 1st list.
    4) each <option>'s value is set to the page hello.html
    Piece of cake! That all works, but here's the real issue:
    Let's say you click on an option from the 1st <select> list, which populates the 2nd <select> list with some options. You then click on the 2nd box, select an option, and it jumps to hello.html.
    Now you press the back button - here are some things I observed:
    First, let me note, that for my example, I'm using car makes for the 1st list, and car models for the 2nd.
    * notice that only the 1st select list is still showing the selection you made, but the 2nd one shows nothing. Plus, when you click on the 2nd list, all that is shown is, in my example, "Then a Model". Not the original options that populated this list, when you had selected a car make from the first.
    *also, if you select "Then a Model" in the 2nd, it will error out, because there isn't a link set for that option. I would actually prefer that the page doesn't jump anywhere if "Then a Model" was to be selected. But I can probably fix that later.
    * If you try to select the car make you had previously selected again in the 1st menu, it still shows the same thing in the 2nd. Not the car models that it showed you when you had first run the example.
    *) You can get the model options for, just for example, "Acura" back into the 2nd, but you would have to select Audi or BMW and then select Acura again.
    *) if you select the "Select a Make" option in the 1st, it doesn't display "Then a Model" in the second as I would like. But I can probably fix that later.
    Now, here are my questions:
    1) Does anybody know how I can keep the selections "selected" in the page, when a user comes back to it when they press the "back" button?
    2) Do I have to store the options selected somewhere, so the page "remembers" what was selected?
    3) Would it help if I used session tracking?
    I was told that the problems I've described are because I've implemented a dynamic listbox.
    The value is supposed to be lost if I move to the next page and then click back. Would any of you agree?
    Any ideas/suggestions at all would be very much appreciated!
    ************************ HERE'S THE CODE **********************************
    This is dynamiclists.html I've commented it probably more than necessary for all you skilled JavaScript programmers, but I thought it would help to have an explanation for each piece of code.
    <html>
    <head>
    <script language=javascript>
    //here I create the multi-dimensional array to hold my
    //values for each make and model to be put into the
    //lists
    var cars = new Array();
    cars['Acura'] = new Array('Legend');
    cars['BMW'] = new Array('740i');
    cars['Audi'] = new Array('A4');
    //method used for my onChange event in the first select list (Make)
    //method accepts the value of the selected index
    function createModel(makeName) {
    //variables used for short-cutting to form elements
    //references the form
    var myform = document.selections;
    //Make selection list
    var Make = myform.Make;
    //Model selection list
    var Model = myform.Model;
    //holds the item selected in the first list -- ex. Acura or Audi
    var makeName = myform.Make.options[myform.Make.selectedIndex].value;
    //to be set to a new Option
    var theOption;
    //if Select a Make is selected, clear the Model select list, and just put
    // Then a Model in it
    if(Make.selectedIndex == 0) {
    Model.length = 0;
    Model.length = 1;
    Model.options[0].text = "Then a Model";
    Model.options[0].value="Then a Model";
    // if you select Acura from Make
    if(makeName == "Acura") {
    // fill first position in Model select list with the Then a Model, so the
    // user knows to select a Model after a Make
    Model.options[0].text = "Then a Model";
    Model.options[0].value = "Then a Model";
    // loop through the array elements that match makeName (which for example
    // could be Acura
    for(var i=0; i<cars[makeName].length; i++) {
    // create a new Option for each Model available
    theOption = new Option(cars[makeName], i);
    // put the Model into the Model select list starting at position 1, not 0 because
    // position 0 is taken up by Then a Model that was set above.
    // Thus why I put (i+1)
    Model.options[(i+1)] = theOption;
    // set each Model options link to hello.html, just for now.
    Model.options[(i+1)].value="hello.html";
    }//end for
    }//end if
    // repeat for BMW and Audi
    if(makeName == "BMW") {
    Model.options[0].text = "Then a Model";
    Model.options[0].value = "Then a Model";
    for(var i=0; i<cars[makeName].length; i++) {
    theOption = new Option(cars[makeName][i], i);
    Model.options[(i+1)] = theOption;
    Model.options[(i+1)].value="hello.html";
    }//end for
    }//end if
    if(makeName == "Audi") {
    Model.options[0].text = "Then a Model";
    Model.options[0].value = "Then a Model";
    for(var i=0; i<cars[makeName].length; i++) {
    theOption = new Option(cars[makeName][i], i);
    Model.options[(i+1)] = theOption;
    Model.options[(i+1)].value="hello.html";
    }//end for
    }//end if
    }//end createModel
    // this is for the onChange event in the Model selection list.
    // this takes care of the jump when you click on a Model.
    // you will be taken to hello.html, which has been set in each option above
    function MM_jumpMenu(targ,selObj,restore){
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"';")
    if (restore) selObj.selectedIndex=0;
    </script>
    </head>
    <body>
    <form name="selections">
    <select name="Make" onChange="createModel(this.options[this.selectedIndex].value);">
    <option value="Select Make" selected>Select Make
    <option value="Acura">Acura
    <option value="BMW">BMW
    <option value="Audi">Audi
    </select>
    <select name="Model" onChange="MM_jumpMenu('parent',this,0)">
    <option value="Then a Model" selected>Then a Model
    </select>
    </form>
    </body>
    </html>
    ***************************** END OF DYNAMICLISTS.HTML ***********************************
    Here's my simple hello.html
    <html>
    <body>
    Hello to all!
    </body>
    </html>

    I have a html:
    <html>
    <head>
    <script>
    var store = new Array();
    store[0] = new Array(
         'labas11',
         'labas12',
         'labas13');
    store[1] = new Array(
         'labas21',
         'labas22',
         'labas23');
    // Funkcija skirta dedant naujienu
    // irasa formuoti sarasa kuriems vartotojams bus siunciama zinute
    function populate()
         var box = document.forms[0].first;
         var number = box.options[box.selectedIndex].value;
         if (!number) return;
         var list = store[box.selectedIndex];
         if (list.length==null) return;
         var box2 = document.forms[0].second;
         box2.options.length = 0;
         for(i=0;i<list.length;i++)
              box2.options[i] = new Option(list,list[i]);
    function addGroup()
    var box = document.forms[0].first;
         var number = box.selectedIndex;
         if (number>-1)
    document.forms[0].third.options[document.forms[0].third.options.length]=new Option('[G] '+box.value,document.forms[0].third);
    function addUser()
    var box = document.forms[0].second;
         var number = box.selectedIndex;
         if (number>-1)
    document.forms[0].third.options[document.forms[0].third.options.length]=new Option('[V] '+box.value,document.forms[0].third);
    function removeOne()
    var box = document.forms[0].third;
         var number = box.selectedIndex;
         if (number>-1)
    box.remove(box.selectedIndex);
    function removeAll()
    // alert(document.forms[0].third.options[0].text);
    var box = document.forms[0].third;
         box.options.length=0;
    function selectToList()
    //this code selects all the elements in the select field
    for(var i=0;i<document.forms[0].third.length;i++)
    document.forms[0].third.options[i].selected=true;
    alert(document.forms[0].third.options[i].text);
    </script>
    </head>
    <body>
    <form action='servlet/List' method=Post>
    <select size=4 name="first" style="width:200px" onchange="populate()">
         <option value="0">html</option>
         <option value="1">css</option>
    </select>
    <select size=4 name="second" style="width:200px">
    </select>
    <select size=4 name="third" style="width:200px" multiple>
    </select>
    <input type=submit value=spausk onClick="selectToList();" />
    </form>
    <table>
    <tr><td><button onclick="addGroup()"> &#302;d&#279;ti grup&#281; </button></td></tr>
    <tr><td><button onclick="addUser()"> &#302;d&#279;ti vartotoj&#261;</button></td></tr>
    <tr><td><button onclick="removeOne()"> �alinti </button></td></tr>
    <tr><td><button onclick="removeAll()"> I�valyti </button></td></tr>
    </table>          
    </body>
    </html>
    and servlet:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class List extends HttpServlet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
         { doAction(request,response);}
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
         { doAction(request,response);}
         public void doAction(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              response.setContentType("text/html;charset=windows-1257");
              PrintWriter out = response.getWriter();
         String[] strArray=request.getParameterValues("third");
              out.print("Value: "+strArray[0]);
    So what is wrong because servlet prints bad value [object]
    Thanks

  • Adding items to a selectOneListbox from Javascript

    In my JSF page I have...
    <h:form id="alternateDeviceSelectForm">
        <h:selectOneListbox id="selectBox"/>
        <h:commandButton id="okButton" value="#{i18n.ok}" action="#{aBean.anActionMethod}"/>
    </h:form>I also have this Javascript...
    for (var i=0; i < devices.length; i++) {
        var device = devices;
    // a String
    var id = device.getId();
    // another String
    var displayName = device.getDisplayName();
    this.selectBox.options[i] = new Option(displayName,id);
    This creates the listbox and when the Javascript method fires, the appropriate items are listed in as list items.  However, when I hit the OK button, I get a JSF message about a validation error.  I'm not using any custom validation at all.
    Here's the error message I get... "alternateDeviceSelectForm:selectBox: Validation Error: Value is not valid"
    Any ideas on how I can get this working?  (I have to get the listbox item values from Javascript because that is the interface to a browser plugin that is involved in this process.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    dalearyous wrote:
    the only thing is there is no data to begin with. after you choose the data structure there is a text field to type in something like apple and then you click add. then you can type in something like pear and click add.If you do it right, the part that controls the data structures won't need to directly interact with the part that adds/removes the elements in the data structures -- they'll be independent units. That's what we call "orthogonal", and it helps make programs much easier to develop and maintain. To do that, you have a common set of add/remove operations across all data structures -- just like in the Collections framework, which you should use unless your teacher is telling you that you must make your own. (And even if you do, ask your teacher if you can use the interfaces from the Collections framework, if not the implementations.)
    The example I showed you supports that, in that it doesn't assume that the data structures initially contain any data. (Though it might be better to create empty Collections in your constructor, rather than ever letting existingCollection go null.

  • How to get page number from the PDF using Javascript

    Hi,
    We are having list of Single page PDF. The pdf are named in the order,
    ISBN_Author_01.PDF  (with real page number as i)
    ISBN_Author_02.PDF  (with real page number as ii)
    ISBN_Author_03.PDF  (with real page number as iii)
    ISBN_Author_04.PDF  (with real page number as 1)
    ISBN_Author_05.PDF  (with real page number as 2)
    ISBN_Author_06.PDF  (with real page number as 3)
    ISBN_Author_nn.PDF  (with real page number as 500)
    Here each pdf has a page number and in sequential order.
    The task is to check whether all the pdfs are in sequential order (i.e i, ii, iii, 1, 2, 3). If any page is missing, the script should throw an error report.
    To do this task, I am writing a Javascript to get the real page number from the PDF.
    Can anybody help me how to get the page number from the PDF using Javascript.
    Thanks,
    Gopal

    The "real" page number within a PDF is the count of the physical page starting at 0, zero.
    pageNum numPages
    The number printed on each page is the page label.
    setPageLabels  getPageLabel
    You will have to open each PDF and your script would need to know the page label for that file. I would expect you would need to build a 2 dimensional  array of the file names and the page label for the page within that array.

  • Detecting Overset from inside another textframe:Javascript

    I had written an applescript that will find overset text boxes, and tried and fix them (if the text box expanded to far into another it wouldn't fix it). now I'm trying to do it in Javascript. I was able to write some code that works on a normal text box. however there are some text boxes, that are in another box (bordered 1pt). The script doesn't seem to see those.
    I'm guessing because its a text frame in another (bordered frame). If this is the case Im not sure how to tell the script to look into a text frame, for another tet frame that overset.
    Applescript nevermade that distinction if it was over set it fixed it.
    Can anybody help

    @Jonny – regarding scope of a script, what object it can act upon and what object is "invisible" or not reachable, ExtendScript (and also AppleScript, I think) has not an allTextFrames array.
    In contrast to the allGraphics array which returns all Graphic objects, nested or not.
    Or the allPageItems array, which  returns nearly all page items, and of course also textFrames, which is a subclass of pageItem.
    In short and missing some important details: you could loop through all page items of the allPageItems array, check, if one of the pageItems is an overset text frame and do your thing.
    In ExtendScript that would be:
    var myDoc = app.documents[0];
    var textFrameIDArray = new Array();
    //Getting the ID of text frames looping through ALL page items:
    for(var n=0;n<myDoc.allPageItems.length;n++){ 
        if(myDoc.allPageItems[n].getElements()[0].constructor.name === "TextFrame"){
            textFrameIDArray[textFrameIDArray.length] = myDoc.allPageItems[n].id;
    //Looping through all Text Frames, also the nested ones:
    for(var n=0;n<textFrameIDArray.length;n++){
        var myCurrentTextFrame = myDoc.pageItems.itemByID(textFrameIDArray[n]).getElements()[0];
        if(myCurrentTextFrame.overflows){
            //Some dummy code here
            //Sets the fill color of an overset textFrame to yellow.
            doSomethingWithOverflow(myCurrentTextFrame);
    function doSomethingWithOverflow(myTextFrame){
        //Do YOUR thing here!
        myTextFrame.fillColor = "Yellow";
    Why would I store the ID of an TextFrame in the first loop and not doing instantly something like checking for overflow and correcting that?
    Depending what you do with nesting overset text frames, it could be that correcting the overflow could generate new overset text frames and in storing the IDs of all textFrames I can come easily back like in the second loop to check for overset. Sometimes you cannot correct overset so I would not recommend a while loop running on the positive test for overset text frames present in the document.
    Uwe

  • Can I use JavaScript to force objects to overlap a Web Object in Captivate 7?

    Hi, so I have all of these great ideas for using Web Objects to enhance my courses, but am discouraged by the fact that I can't seem to get anything to overlap a Web Object. The only thing I can seem to get to overlap a Web Object is another Web Object. I have found that buttons seem to still work under the Web Object (which is good) but I really would like to know of a way to allow things on the Captivate timeline to be viewed on top of them. Things like text fields and images.
    I've seen posts about how to use JavaScript to have the menu show above Web Objects, but that code doesn't seem to work for regular objects. I read that Web Objects sit in an "<iframe>" tag and that that forces it to appear above everything else. I'm left wondering if it is possible to get around this by somehow putting Captivate objects in an <iframe> of their own with JavaScript? Or is there some other way? Does anybody know any JavaScript I can apply to Captivate objects to get them to appear above a Web Object?
    Thanks,
    Dan

    So I have come to learn that the "<iframe>" tag for a Web Object is simply a window that sits on top of the course. Now I'm wondering if anyone has an effective method for importing flash quality animation (in whatever form) that can sit underneath of Captivate objects and still be HTML5 compliant?
    Thanks,
    Dan

  • CRM 2013 - Inconsistent javascript issue crash the web client and user needs to reopen

    Hello,
    We are using CRM 2013 on premise version and almost 600 users are using it. We have some inconsistent JavaScript issue (following is the log for same) which happens to users in a day or two. When this issue occurs user can not work in system and they have
    to open new instance of CRM.
    Does anybody knows about this error?
    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
       <Message>Unable to get property 'location' of undefined or null reference</Message>
       <Line>1</Line>
       <URL>/_static/_common/scripts/main.js?ver=1676323357</URL>
       <PageURL>/main.aspx#313155368</PageURL>
       <Function>anonymous($p0,$p1,$p2){this.$3_3.get_currentIFrame()&&Mscrm.PerformanceTracing.write("Unload",this.$3_3.get_currentIFrame().src);this.$H_3=$p0.toString();this.$26_3();this.$1A_3();this.$1J_3();if($p0.get_isLocalServer())$p0.get_query()["pagemode"]="iframe</Function>
       <CallStack>
        <Function>anonymous($p0,$p1,$p2){this.$3_3.get_currentIFrame()&&Mscrm.PerformanceTracing.write("Unload",this.$3_3.get_currentIFrame().src);this.$H_3=$p0.toString();this.$26_3();this.$1A_3();this.$1J_3();if($p0.get_isLocalServer())$p0.get_query()["pagemode"]="iframe";addPassiveAuthParameters($p0);var$v_0=$p0.toString();if(IsNull($p2))$p2=false;var$v_1=this.$18_3($p0,$p2);if($v_1){if(this.$2z_3()){window.location.reload();return}this.$2d_3();this.$1s_3();Mscrm.PerformanceTracing.write("Navigate",$v_0);!Mscrm.Utilities.isIE()&&this.raiseEvent(Mscrm.ScriptEvents.UpdateTopLocation,null);this.$3_3.get_currentIFrame().contentWindow.location.replace($v_0)}else{this.$10_3();var$v_2=this.get_contentWindow().Sys.Application.findComponent("crmPageManager");if($v_2){!Mscrm.Utilities.isIE()&&$v_2.raiseEvent(Mscrm.ScriptEvents.UpdateTopLocation,null);var$v_3={};$v_3["sourceUri"]=Mscrm.Utilities.getContentUrl(null);$v_2.raiseEvent(Mscrm.ScriptEvents.IFrameReactivated,$v_3)}}window.self.InnerIFrameSrcChangeTimestamp=(newDate).getTime();this.title=$p1;if(window.LOCID_UI_DIR==="RTL"&&$p0.toString().indexOf("PersonalWall")>=0&&window.UseTabletExperience)this.$3_3.get_currentIFrame().style.position="RELATIVE"}</Function>
       </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
       <BrowserUserAgent>Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)</BrowserUserAgent>
       <BrowserLanguage>en-US</BrowserLanguage>
       <SystemLanguage>en-US</SystemLanguage>
       <UserLanguage>en-US</UserLanguage>
       <ScreenResolution>1366x768</ScreenResolution>
       <ClientName>Web</ClientName>
       <ClientTime>2015-04-20T15:41:12</ClientTime>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>{E8BBA7AE-A552-DE11-B475-001E0B4882E2}</OrgID>
        <UserID>{614837CD-448B-DE11-A5E1-005056970D6C}</UserID>
        <CRMVersion>6.1.2.112</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    Are you on-premise, or on-line? : It's on-premise
    Can you reproduce it on-demand, or is it sporadic?: It's sporadic
    There is a mention of loading an iFrame in the error, do you have iFrames on the form that generates this error?
    It's not on specific forms, so can't identify that. Yes we have iframes on some forms.
    Does it happen on any/all entity forms, or specific ones?  Do the entity forms have any custom JavaScript on them?
    It's not on specific forms. And yes we have javascript on almost all forms.
    Do you have any network problems or slowness in your network? Does the problem happen when the network is busy?
    We need to check this on next occurrence.
    Do the users that see this error have any unusual add-ins or toolbars in their browser?  This is not for specific user. Its happening for all randomly.
    Have you tried other browsers like Chrome or FireFox and do users see the problem there as well?
    We need to check only for IE.

  • Trying to load a javascript link from text file into a dynamic textfile

    Can anyone help me with this problem? Im trying to load in a
    newsfeed from freshcontent.net into my text field. If i put this
    javascript link on an html page, the page shows correctly, which is
    im supposed to get 3 dynamic links with news content headlines.
    Please view the link to see what i mean:
    http://www.freshcontent.net/directory/real-estate/real_estate.html
    Now, i cannot get this same type of display behavior in my
    text field if i just paste into my text file the javascript link
    thats supposed to bring up the 3 headlines. It is my understanding,
    that flash cannot do this without some sort of specific
    actionscripting, that involves asfusion, and/or externalInterface.
    Im not sure exactly how to go about setting this up to make this
    work. My current code looks like this:
    If anybody could tell me where im going wrong and what i
    should change in order to get the desired result im going for, Id
    very much appreciate it. Thanks

    well sorry there fanmap - but I don't think you're going to
    be able to get this to work. here's why: the link points to a php
    file - which gathers dynamic info from a DB - the return from the
    php is generating a string that is based on the DOM and
    'constructs' a javascript method that in turn writes to the html
    document. although we can embed html into a textField in Flash
    there are a limited number of supported html tags - and JS methods
    will not operate internally. in addition, (i'm not certain someone
    correct this if i'm off) there's no way to 'change' the output of
    the php call, therefore you will not be able to read the return
    because it is designed to use the DOM and write solely to the
    current document. Even if you were to access the JS method from the
    swf file (which one can) it will still only write the content of
    the php return to the html document - and the output is not
    compatible with the textField class.

Maybe you are looking for

  • Form is giving me error in Acrobat 8, but not Reader 8?

    Ok, so I created a form in Livecycle Designer, and I made it so that when a certain option is selected from the drop down box, new form fields will automatically pop up. First off, there is one box that takes a few seconds to pop up when the selectio

  • Can you use specific Core MIDI inputs in LE7?

    In various other MIDI applications on OS X, you can see a list of the current Core MIDI inputs and outputs, usually for the purpose of telling the application which input(s) and output(s) to use. For instance you might want to use something like Midi

  • Function Call returning old SQL Query

    Hello All, I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. Inside this function, once the SQL is built, I am inserting this SQL into a log t

  • Building code field in Ship to address

    HI all, Please tell me FM to fetch Ship to address  info actually i want Building  code field ?? which is stored in structure. Any suggestions welcome, Regards,

  • IPhoto does not open back-up library and requests library manager which does not work either

    Hello, I have a problem and NO idea how to fix it. I try to write it in bullet points to make it easier to read: - My MacbookPro (from 2009) with current software (mavericks, all updates) went offline due to lack of battery while I was working in iPh