Generating an SWF using Javascript

Has anyone had any success generating an swf using nothing
but javascript. Is there a module or an API that I can tap into to
accomplish this feat.
Thank you for your time

Unfortunately, we indeed found no 'solution' for the problem... however we could solve it by creating an 'Send email' page to send the email via the server.... now we could use POST request and use "BIG" data...
Luckily our customer didn't see the sending via another emailadres as a problem...
Thanks for your help...
Regards,
Robert

Similar Messages

  • To dynamically  generate text box using javascript

    hi...
    i want to have a button such that if he clicks that button 2 textboxes be generated side by side.
    i want the textboxes to be added just above the button so that the button is always below the newly created textboxes.
    its not only once i want this ..i want that whenever he clicks the button 2 textboxes gets added everytime...
    how can i achieve this?
    thanks

    Ok, so this is a complete thread hijack - probably would have been worth a new thread.
    The initial solution involved javascript completely.
    The problem breaks down to
    1 - identify when we should move focus
    2 - identify which field focus should move to.
    Here is one version. This approach gives each textfield an individual name/number so you can find its "matching" pair.
    <html>
    <head>
      <script>
      var numLinesAdded = 0;
      function focusNext(tBox){
        var name = tBox.name;
        var index = name.substring(name.indexOf('_')+1);
        var brother = eval("document.all.txt2_" + index);   
        var l = tBox.value.length;   
        if (l >= tBox.maxLength){
          brother.focus();
         function generateRow() {
         var d=document.getElementById("div");
         d.innerHTML+="<input type='text' maxlength='5' name='txt1_" + numLinesAdded + "' onkeypress='focusNext(this)'>";
         d.innerHTML+="<input type='text' name='txt2_" + numLinesAdded + "'><br>" ;
         numLinesAdded++;
    </script> 
    </head>
    <body>
    <form>
    <div id="div"></div>
    <input type="button" value="Add" onclick="generateRow()"/>
    <input type="submit">
    </form>
    </body>
    </html>

  • How to generate a pdf file using javascript?

    I would like to generate a pdf file having images in it using javascript. I tried jsPDF but getting some exceptions like
    Uncaught ReferenceError: pageWidth is not defined,
    fail to load pdf document
    Could anyone show me some pointers?
    Thank You
    Rahul

    Here is my code
    var myImg=new Image();
      myImg.src=arrData['employee'][1]['Image'];
      myImg.crossOrigin ="Anonymous";
       var imgData = this.getBase64Image(myImg);
       var doc = new jsPDF();
       doc.setFontSize(40);
       doc.text(35, 25, "Test Image");
       doc.addImage(myImg, 'JPEG', 15, 40, 180, 160);
       doc.save("sample1.pdf");
    I'm receiving the following error at 'addImage' function.
    Uncaught Error: getJpegSize could not find the size of the image
    Could you please help in pointing out where am I going wrong.
    Thank You

  • How to control SWF Video using JavaScript?

    Hi,
    I'm developing a web page which will use Flash Videos. I need
    to control the video without using a typical skin. The current tool
    I'm using to convert my wmv to SWF FLV is Coffee Cup. A hex edit
    suggests this is a Version 8 SWF.
    I am trying to write some javascript to control which Frame
    is displayed. I have seen code such as movie.TGotoFrame(...); and
    movie.GotoFrame, movie.StopPlay() etc. Unfortunately I cannot seem
    to use these methods. Eventually I suspected that my SWF simply did
    not make these methods available and when I run my video in my web
    page a RightClick shows a Context Menu that has no Reverse,
    Forward, Back options. Other SWF videos do have these options
    (obviously). This seems to prove that nothing I could code would
    make the GotoFrame work (ie no Forward (by one frame) option in
    menu suggests it could never work from javascript).
    Some Questions
    Is there a tool to examine a SWF to see what methods are
    available to javascript control? (expose the API) and is there a
    setting required in the <object> setup to enable javascript
    interaction?
    Is there something about SWF V8 files that is the problem or
    is likely that the CoffeeCup Web Video Player can only make
    partially functioning SWF Videos?
    What is the difference between GotoFrame and TGotoFrame and
    have these perhaps been superceeded by something else (there is an
    Adobe page which suggests they are only available up to Version 5
    (not sure if that means Version 5 of SWF files or Version 5 of the
    FlashPlayer - to add to my confusion).
    I'm not currently a Flash type developer and have no tools to
    speak off and don't know ActionScript. I'm thinking of heading in
    the Flash direction but not sure how to move forward.
    Cheers
    Stuart

    Thanks Alex,
    quote:
    You need to learn to move forward :)
    I have a Greek friend who when I asked him how he was getting
    on with his dissertation project stated "in Greece we have a saying
    - every start is different".
    In this case my start is to dip a toe in the Flash water and
    not get scalded.
    Anyhow,
    One clarification from the CoffeeCup forum helped me to
    understand that my SWF used an external FLV and that may explain
    why the rightclick context menu did not have the more movie
    specific Back, Forward etc. Sounds plausible. So assume external
    FLV.
    quote:
    it is very easy to add a small script into the root timeline
    of your SWF file
    A little hand holding here would be appreciated. I have
    downloaded the Flex SDK. Can I use this free tool to do what you
    suggest? Using MXML and ActionScript. If so, a little bit more info
    would help.
    quote:
    That's all, it should work. Of course, you can tell me that
    your movie
    already has an onEnterFrame() eventhandler at the root
    timeline.
    What's a problem? Just create an empty movieclip and add this
    script
    into its frame 1 (it maybe the only frame). But do not forget
    to
    change "this.xxxx" to "_root.xxxx" within such script.
    Hhhmmm. A bit stumped. I've had a look at the SWF using
    FlashDig. I noticed what appears to be Assembly Language (Push,
    Pops, Jumps etc) and presumably in amongst all of that may be an
    onEnterFrame. Perhaps linked to a DefineFunction2 node.
    Unfortunately the SWF is very large (60K) and there is no
    search/find tool so that makes finding functions a bit harder than
    expected. Struggling a little with the concept of _root and Level0
    etc.
    I assume you are suggesting manually building a replacement
    SWF (empty movieclip?) if the onEventHandler happens to be used for
    something else. Presumably set/getVariables only interacts with
    this function so if it is 'booked' in my SWF I would be in a spot
    of bother with your suggested approach?
    I wonder if you are assuming I have some sort of Flash tool.
    Possibly like this one shown in this tutorial
    WebWasp
    Panorama tutorial
    Note. The panorama is actually close to what I eventually
    want to do except I intend to make a video of a scene by rotating
    clockwise by 360 degrees. Then add buttons onto the SWF (or DHTML)
    which communicates with the SWF to move forward or back through the
    video. Moving forward would be like a clockwise rotation and moving
    back would create anticlockwise rotation. This explains the need to
    GotoFrame (or similar). From that perspective I don't need to
    become a Flash guru (for now) and can't justify buying all the
    expensive flash tools for this one (apparently) simple task: Frame
    by Frame control of an external FLV via the SWF.
    Note. I've started using SWFObject. Might this library help?
    In summary.
    How do I add the onEnterFrame ActionScript sample (or
    something similar) into a SWF using only the Flex SDK command line
    tools or similar in order to control an external FLV?
    Cheers
    Stuart

  • Generate an xml-file by using javascript

    Hi,<br /><br />i'm working on a form with Adobe Designer.<br /><br />My goal is to generate my own xml file using javascript, attach this to mail also generated by using javascript (app.mailMsg(false, "<mail address>", "", "", "<mail subject>", "<mail body>" --> this works already :-)) and send it.<br /><br />By now i have:<br /><br />---------------- my code --------------------------------------<br /><br />var container = "";<br /><br />container = "<?xml version="1.0" encoding="UTF-8"?>\n";<br />container = container + "<header>\n";<br />container = container + "<author> author name</author>\n";<br />container = container + <authorMail>my mail</authorMail>\n";<br />container = container + "</header>\n";<br />container = container + "<Daten>\n";<br />container = container + "<name>" + field.value + "</name>\n";<br />container = container + "<adresse>" + field.value + "</adresse>\n";<br />container = container + "<ort>" + field.value + "</ort>\n";<br />container = container + "<staat>" + field.value + "</staat>\n";<br />container = container + "<plz>" + field.value + "</plz>\n";<br />container = container + "<land>" + field.value + "</land>\n";<br />container = container + "</daten>\n";<br /><br />---------------- end of my code -------------------------------<br /><br />This works fine, and i have my xml content in the var container.<br />After that i try this:<br /><br />---------------- my code --------------------------------------<br /><br />var myDoc = event.target;<br />myDoc.createDataObject("filename.xml", container);<br />myDoc.exportDataObject("filename.xml");<br /><br />---------------- end of my code -------------------------------<br /><br />Instead of event.target i write down click.Form1<br />This doesn't work at all :-( anyone an idea?<br /><br />Lots of thanks for your help,<br />aldo

    Hi everybody,<br /><br />the code works good now. so it should be available for everybody who needs it:<br /><br />---------------- my code --------------------------------------<br /><br />var container = "";<br /><br />container = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";<br />container = container + "<all>\n";<br />container = container + "<header>\n";<br />container = container + "<author>author name</author>\n";<br />container = container + "<authorMail>[email protected]</authorMail>\n";<br />container = container + "</header>\n";<br />container = container + "<body>\n";<br />container = container + "<name>" + value + "</name>\n";<br />container = container + "<adresse>" + value + "</adresse>\n";<br />container = container + "<ort>" + value + "</ort>\n";<br />container = container + "<staat>" + value + "</staat>\n";<br />container = container + "<plz>" + value + "</plz>\n";<br />container = container + "<land>" + value + "</land>\n";<br />container = container + "</body>\n";<br />container = container + "</all>\n";<br /><br />var myDoc = event.target;<br />myDoc.createDataObject("export.xml", container);<br />myDoc.exportDataObject("export.xml");<br /><br />app.mailMsg(false, "mail-address1; mail-address2", "", "",<br />"mail subject", "mail body");<br /><br />---------------- end of my code ------------------------------- <br /><br />now i'm looking for a solution to automatically attach the file to this mail and directls sent it without to call up the mail client.<br />if anybody has got an hint, you're welcome ;-)

  • How to use JavaScript in Web bean generated JSP

    I want to do some simple JavaScript validations (for example, checking if a particular field is empty) in the JSP page rendered by the data web bean. Because the HTML is rendered by the bean, I'm not able to refer to the HTML controls in the JSP page. I'm not even able to refer to the form with the following standard piece of JavaScript code - "document.forms[0].control_name".
    Is anybody aware of how to use JavaScript with these rendered JSP pages?

    You just have to add it like and applet , including this line in your JSP or JSF
    <script src="http://dl.javafx.com/dtfx.js"></script>Then add the applet
    <script>
        javafx(
                  archive: "./resources/jar/Draw.jar",
                  width: 400,
                  height: 200,
                  code: "Draw",
                  name: "Draw"
    </script>./resources/jar/Draw.jar - is the path and the name of the jar

  • Using javascript to copy to the clipboard in Safari

    I had an application for taking notes in IE for the windows computers at my company. It used Javascript to copy the contents of a text box to the clipboard.
    Now that we've switched to macs (and love them), this no longer works in eitehr Safari, Firefox, or Camino for the mac.
    If there is a javascript command that will let you copy a text box's contents to the clipboard that works with any of these browsers, I'd be greateful for a few pointers int he right direction.
    Thanks in advance!

    jalperin wrote:
    > Here's what I'm doing:
    >
    Using a data set observer, check for
    onPostLoad and generate the html
    > code
    >
    Using innerHTML, stuff the code into
    the appropriate <div>
    >
    Use regionName.updateContent() to
    update the region I just created
    > with the html code I generated
    >
    > Interestingly, if I take the generated source for my
    page and remove the data
    > set observer, the Spry table displays correctly with all
    the expected values.
    > This suggests to me that my generated html code is
    correct, but that there is
    > some sort of timing issue (i.e. Spry doesn't know about
    the new code I
    > generated).
    >
    > Any suggestions?
    I'd guess that it is a timing issue as well. I haven't looked
    much at the dataset capability in Spry, but it may be that the
    dataset "finds" all of the regions and code that it applies to
    before the onPostLoad event is triggered. If that is the case, then
    your generated code doesn't exist yet,and so the dataset thinks
    that there is nothing for it to apply to.
    Will the HTML that you generate change based upon the dataset
    that is actually returned? I guess I'm looking for the reason why
    the HTML is being generated when it could be in the page itself and
    avoid this issue completely.
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • Using javascript to control the browser

    Hi all,
    One of the most requested features on our first Breeze
    project was a "quit" button. The easiest way to do so in an HTML
    environment is to use the command
    javascript: window.close();
    Type this into the address bar on your browser, and hit
    return. Isn't that neat?
    Okay, the scripting language in Flash (Actionscript) can
    simulate typing something in the address bar with the command
    getURL ("javascript: window.close();");
    ...all we have to do is add that actionscript to the
    onRelease event handler for a button in Flash. Then, add the button
    to your PowerPoint before you use Presenter, and when the student
    clicks it... voila!
    This same trick can be used to replace that MacroDobe©
    logo in the Breeze player. This time, when the user clicks the
    button, we'll use javascript to pop up an alert box with a clever
    message:
    getURL ("javascript: alert('Aren't we clever?');";
    This button has to be small, around 50 x 29 pixels, to
    properly replace the logo. To actually replace it, you need to
    publish your presentation to the hard drive like normal. Next, find
    the folder you published to, and place a copy of your "button.swf"
    file in the "data" subfolder. Then, edit (don't "open") the
    vconfig.xml file in the same subfolder using notepad. Near the top,
    you'll find an entry that says:
    <uireplace name="logo" value= "" />
    place the name of your button file between the quotation
    marks and save:
    <uireplace name="logo" value= "button.swf" />
    When you load up the training next time, the logo will have
    changed to your button.
    You'll have to do this every time you publish the training,
    as Presenter deletes & recreates all those subfolders each time
    you do. BTW, MacroDobe© does offer a small applet to parse
    this xml file for you... but they want 5 grand per copy. I'm
    thinking notepad works just as well :)
    cheers!
    Marc B

    The biggest difficulty with a Swing Applet is that it needs the latest version of the JVM to run and many people don't have this installed on their PC. You can set the Aplet tags to download the plug-in but it can discourage users and may not always work. I would only use a Swing Applet for webapps with a limited client base.

  • Using javascript to change the "Overall Result" cell in WAD

    Hi experts,
    I am trying to use javascript to change the text of the "Overall Result" cell in my web template using BI 7.0. I am not familiar with javascript, but I this is what I have done so far.
    I dragged the web item "Script" into my web template and I inserted the following code:
    function change_overall_result_to_average() {
    var cell = document.getElementsByTagName("TD");
    var cellText;
    for (i = 0; i < cell.length; i++)
          cellText = cell<i>.innerText;
               if (cellText == "Overall Result")
                     cell<i>.innerText = "Average";               
    In the XHTML view I am using added the onload function to start the javascript every time the web template is loaded. The code works fine when the web template is first loaded and the cell text is changed to "Average". However, if I navigate in my web template, the javascript function is not triggered, and the cell is therefore changed back to "Overall Result". For example, this happens when I pick another selection from one of my dropdown boxes, such as changing the selection from year 2008 to year 2007.
    I don't really know how to solve this problem in an easy way, and the current solution is not good enough. I hope one of you guys can suggest an easy way of fixing this:-)
    Best Regards,
    Morten

    Woodstock apparently renders some Javascript/DOM with some homegrown widget framework which on its turn renders the HTML DOM tree instead of plain vanilla HTML. Correct me if I'm wrong, to confirm this, just view the generated HTML source of the page.
    After some Googling I found out that you need getProps() and setProps() to get and set element attributes respectively.
    [http://google.com/search?q=webuijsf+domnode+site:sun.com].
    If you stucks with this, I recommend you to post this question at a forum or mailinglist devoted to Woodstock, e.g at their own homepage at dev.java.net or the Netbeans forum at nabble.com. You're here at a Sun JSF forum, not at a Woodstock forum.

  • Convert PS to PDF file in Adobe Distiller using javascript

    Hi scripters,
    I have created some PS files from Indesign using javascript. Files are d:\test\1.ps,2.ps
    Now I want to convert this ps files into pdf files uisng javascript?(I am not comfort to use export as PDF option for this job)
    how I can do this?
    Thanks in advance
    regards
    a r u l

    Hi arul
    Firstable, you may not need to create PS files as Indesign is able to produce PDF files natively. I was told that it was more reliable to do so using a certification profile such as PDFX.
    You will find a lot of PDF export script everywhere.
    However, if you want to go that way (PS to PDF). I did that once.
    First you determine into distiller a hotfolder where you ps files wille be generated. Then in the hotfolder options, you precise the profile you want to use. Otherwise, distiller may be using low quality PDF as default and your PDF may not be as good as you want.
    var distiller = File("c:/xxx/yyy/zzz/distiller.exe"); //the path to your distiller app.
    distiller.execute();
    Here you are !
    Loic

  • AS3.0 External Interface: Pass variables to flash using javascript

    Hello all,
    I am looking for a simple and straightfoward example of how I can pass the value of a variable into flash using javascript.
    Specifically, I'd like to use javascript to pass the filename of an external video file that I would like to load into my flash movie.
    I'd also like to call a function in the SWF that plays the movie once the filename as been passed to the flash movie.
    External Inferface looks like the way to go.
    I've found a few decent AS2.0 examples, but converting them to AS3.0 has proven difficult and many of the examples are much too complex for what I am trying to do.
    If you have any code samples or tutorials showing the HTML/Javascript and the associated actionscript I'd really appreciate it!
    Thanks!
    Tim

    if you create a swf (eiTest.swf) and html:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
        <head>
            <title>eiTest</title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <script language="JavaScript">
             function thisMovie(movieName) {
             if (navigator.appName.indexOf("Microsoft") != -1) {
                 return window[movieName];
             } else {
                 return document[movieName];
         function f1(value) {
             thisMovie("eiTest").jsF(value);
    </script>
        </head>
             <body onload="f1('yourfilename.ext');">
         <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                 id="eiTest" width="550" height="400"
                 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
             <param name="movie" value="eiTest.swf" />
             <param name="quality" value="high" />
             <param name="bgcolor" value="#869ca7" />
             <param name="allowScriptAccess" value="sameDomain" />
             <embed src="eiTest.swf" quality="high" bgcolor="#869ca7"
                 width="550" height="400" name="eiTest" align="middle"
                 play="true" loop="false" quality="high" allowScriptAccess="sameDomain"
                 type="application/x-shockwave-flash"
                 pluginspage="http://www.macromedia.com/go/getflashplayer">
             </embed>
         </object>
        </body>
    </html>
    you can use:
    import flash.external.ExternalInterface;
    ExternalInterface.addCallback("jsF", asF);
    function asF(fileS:String):void{
    trace(fileS);

  • How to read size of swf through javascript

    According to the swf documentation from Adobe, you should be
    able to read the individual bytes of a swf to calculate the files
    size, file dimensions (width and height), version and file type
    (swf or swc).
    I am using javascript to read in the individual bytes and
    converting them to human readable information but I am running into
    problems when it comes to file dimensions.
    My question is has any one been able to get the file
    dimensions of a swf file using any language? I am using javascript
    but I would think that the byte order would be the same in any
    language.
    Here is the out put that I am working with:
    Hex pulled from file:
    78 9C 8C 7C 05 58 55 4B DB F6
    First five bytes = 01111 = read 15 bytes for each value
    dimension 1 = 000100111001000
    2504 twips
    50080 pixels (should be 0)
    dimension 2 = 110001111100000
    25568 twips
    511360 pixels (should be 300)
    dimension 3 = 001010101100001
    5473 twips
    109460 pixels (should be 0)
    dimension 4 = 010101010010111
    10903 twips
    218060 pixels (should be 250)
    The formula I am using for twips -> pixels is px = twips *
    20.
    Is there something that I am missing?
    The raw hex of the beginning of the file is below:
    43 57 53 08 EE A4 00 00 78 9C 8C 7C 05 58 55 4B
    DB F6 DA 9B 2E C9 4D 49 4B 77 48 48 87 20 21 CD
    26 A4 BB BB 41 52 90 0E 29 A5 BB 1B 24 04 24 94
    16 44 24 04 A4 91 90 90 0E C9 7F 6F D4 73 CE FB
    BD E7 FF FE 7F 5D D7 9A FD AC 79 EE B9 E7 99 59
    D3 6B 66 3B 01 18 CD 00 90 21 0E 10 83 80 87 B8
    00 EC 92 02 DF DC DC 00 C8 62 08 2F 40 00 10 EE
    07 60 01 66 C6 EA A6 C6 76 E6 80 BD B1 B5 83 A1
    Thanks

    I get the same twip values as you from the record, but the
    twip->pixel conversions are different (pixels = twips / 20)
    XMin = 000100111001000
    2504 twips
    125.2 pixels
    XMax = 110001111100000
    25568 twips
    1278.4 pixels
    YMin = 001010101100001
    5473 twips
    273.5 pixels
    YMax = 010101010010111
    10903 twips
    545.15 pixels
    I just read the spec, and I am wondering about the remaining
    7 bits until the next byte alignment (1011011). According to my
    interpretation the spec, they should be all zero values.

  • Pre-validation using JavaScript cannot work in JSF?

    Sometimes we need to do pre-validation using JavaScript in some senarios that data need be entered and validated at client site before it reaches to Web Application Server. Remind that JSF is a server validation. Creator seems not to allow Developers to do pre-validation using JavaScript for any editable input fields in form. I will illustrate an example and hope anyone can help me to solve it out.
    Assume that if we write the a new web page that allows User enters Name and Phone. The pre-validation function called test() is written in JavaScript for validating field Phone. For simplicity, the below HTML/JavaScript without nested in table is a simple one for HTML form.
    <html>
    <body>
    <script language="JavaScript">
    function test(){
         if (form1.phone.value == "")
              alert("Please enter phone number in digits.");
              return false;
    </script>
    <form name=form1>
    <input id="phone" type="text" size=20><Br>
    <input id="name" type="text" size=20><Br>
    <input type="submit" id="submit" onclick="test()" value="Submit">
    </form>
    </body>
    </html>
    Now, we consider using Java Studio Creator to generate the same form as describing above. The script is shown below:
    <?xml version="1.0"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <html>
    <head>
    <title>testForm Title</title>
    </head>
    <body rave-layout="grid">
    <h:form binding="#{testForm.form1}" id="form1">
    <h:inputText binding="#{testForm.textField1}" id="phone" style="position: absolute; left: 192px; top: 96px; width: 168px; height: 23px"/>
    <h:inputText binding="#{testForm.textField2}" id="name" style="position: absolute; left: 192px; top: 144px; width: 168px; height: 23px"/>
    <h:commandButton binding="#{testForm.button1}" id="submit" style="position: absolute; left: 192px; top: 216px" value="Submit"/>
    </h:form>
    </body>
    </html>
    </f:view>
    </jsp:root>
    After running Script that Creator created, the HTML is generated and reduced (for simplicity) as follows:
    <f:view>
    <html>
    <body rave-layout="grid">
    <form action="/rave/rave" id="form1" method="post">
    <input id="form1:Phone" type="text"></input>
    <input id="form1:name" type="text"></input>
    <input id="form1:button1" value="Submit" onClick="test()"></input>
    </body>
    </html>
    </f:view>
    Take a look carefully at <input> elements. We see the syntax for naming for each "input" element that there is a semi colon added between form1 and phone or form1 and name. This syntax is generated from built-in JSF components. Hence, I rewrite the test() JavaScript function to match with the naming that Creator generated as follows:
    <script language="JavaScript">
    function test(){
         if (form1.form1:Phone.value == "")
              alert("Please enter phone number in digits.");
              return false;
    </script>
    Clearly, this JavaScript cannot be worked because of a semi column that Creator has named it.
    I have tried to work arround for this but cannot find a solution except changing the name such as: from <input id="form1:phone" ...> to <input id="form1_phone" ..>. But I could not change or modify the scripts because it is generated from JSF components when running it under browser.
    I guess to solve this problem, the naming for elements in form should be reconsidered in the next release of Java Studio Creator.

    Hi Marie,
    I currently sucess in client pre-validation using JSF. I found a way to do it.
    Please take a look of how javascript has been added in the following scripts:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <html lang="en-US" xml:lang="en-US">
    <head>
    <meta content="no-cache" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <title>login Title</title>
    </head>
    <body style="-rave-layout: grid">
    <h:form binding="#{login.form1}" id="form1">
    <h:outputLabel binding="#{login.componentLabel1}" for="componentLabel1" id="componentLabel1" style="position: absolute; left: 216px; top: 72px">
    <h:outputText binding="#{login.componentLabel1Text}" id="componentLabel1Text" value="Application System Name"/>
    </h:outputLabel>
    <h:panelGrid binding="#{login.gridPanel1}" columns="3" id="gridPanel1" style="position: absolute; left: 72px; top: 168px; width: 504px; height: 100px">
    <h:outputLabel binding="#{login.componentLabel2}" for="componentLabel2" id="componentLabel2">
    <h:outputText binding="#{login.componentLabel2Text}" id="componentLabel2Text" value="User Name: "/>
    </h:outputLabel>
    <h:inputText binding="#{login.textField1}" id="textField1" onclick="" style="width: 149px; height: 22px"/>
    <h:outputText binding="#{login.outputText1}" id="outputText1"/>
    <h:outputLabel binding="#{login.componentLabel3}" for="componentLabel3" id="componentLabel3">
    <h:outputText binding="#{login.componentLabel3Text}" id="componentLabel3Text" value="Password: "/>
    </h:outputLabel>
    <h:inputSecret binding="#{login.textField2}" id="textField2" style="width: 147px; height: 22px"/>
    <h:outputText binding="#{login.outputText2}" id="outputText2"/>
    <h:outputLabel binding="#{login.componentLabel4}" for="componentLabel4" id="componentLabel4">
    <h:outputText binding="#{login.componentLabel4Text}" id="componentLabel4Text"/>
    </h:outputLabel>
    <h:commandButton action="#{login.ok_action}" binding="#{login.button1}" id="button1" onclick="return checkUserIdentity(this.form)"
    style="width: 90px; height: 25px" value="OK"/>
    <h:outputLabel binding="#{login.componentLabel5}" for="componentLabel5" id="componentLabel5">
    <h:outputText binding="#{login.componentLabel5Text}" id="componentLabel5Text"/>
    </h:outputLabel>
    </h:panelGrid>
    </h:form>
    </body>
    <script type="text/javascript">
    function checkUserIdentity(form){
    var userName = form["form1:textField1"].value;
    var userPassword = form["form1:textField2"].value;
    if (userName == "") {
    alert("Please enter User Name.");
    form["form1:textField1"].focus();
    return false;
    if (userPassword == "" ){
    alert("Please enter password.");
    form["form1:textField2"].focus();
    return false;
    form.submit();
    return true;
    </script>
    </html>
    </f:view>
    </jsp:root>
    The key for getting data value from Form based on Javascripts is var userName = form["form1:textField1"].value;
    Thanks,
    VTT_

  • How to use JavaScript in Dynamic commandLink

    Hi All,
    In my JSF application, I am able to get the dynamic CommandLink with the below mentioned code.
    commandLink.setActionExpression(createActionExpression("#{myBean.myMethod}", String.class));
    The above code is navigating to the page mypage.jsp properly (the page which is returned by method myMethod).
    My Question is: Instead of navigation (as mentioned above) I want to generate a popup window using JavaScript on click of commandLink.
    Please suggest me on how to proceed on this?

    Hers is my JavaScript:
    function showPopupWindow(action) {
    formId=action.form.id;
    //features="height=300,width=250,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes";
    features="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=900,height=500,top=80,left=80";
    winId=window.open('Mypage.faces','list',features); // open search window
    winId.focus();
    This works perfectly with the onclick attribute of the commandbutton as shown below:
    <h:commandButton value="Open Popup" onclick="showPopupWindow(this); return false;"></h:commandButton>
    {color:#ff0000}
    But I tried same thing with the onclick attribute of the commandLink, that did not work.
    <h:commandLink value="Open Popup" onclick="showPopupWindow(this); return false;"></h:commandLink>
    {color:#0000ff}As per my requirement, I tried using setOnclick attribute in the following manner, that failed to open the popup:
    commandLink.setOnclick("{color}{color}*{color:#0000ff}showPopupWindow(this); return false;{color}*{color:#ff0000}*{color:#0000ff}");{color}*
    {color}

  • How to Use JavaScript in Controller Class...

    Hi All,
    Can any one tell me how to use JavaScript in Controller Class.
    Requirement is:
    I have
    Radio Group(RG1),
    Two Radio Buttons(RB1,RB2),
    Two messageTextInput(MTI1,MTI2),
    if i click RB1 i should Prompt to the end user to "Enter value for MTI1" or
    If i click RB2 i should prompt "Enter value for MTI2" while submitting page.
    Please let me know the steps to use JavaScript and the above client validation...
    Regards
    Alem...

    Using javascript is against the standard. I can tell you a workaround instead of you setting the javascript, check if that would be acceptable.
    You can use PPR and set the required property on the messageTextInput on clicking of the radio button. By doing this you will let UIX generate the javascript for you to handle the client side validation. But the validation will happen only on click of the submit button. The visual indicator is good enough to tell that the value has to be entered to the item.

Maybe you are looking for

  • Does iOS 5.1 and iTunes 10.6 solve changing artwork?

    I subscribed to iTunes Match when it first came out and quickly un-synced it (or whatever the proper verbage is) because it messed up my artwork.  I have many songs (both songs purcahsed from iTunes and songs ripped from CDs) where I changed the albu

  • How to use ES  bundles (with or without PI)?

    Hello Experts, I am new to this forum and this is my first question I am currently working in a landscape comprising of ECC 6.0 EHP4 and APO systems. We do not have SAP PI installation. I wanted to know the right way forward to get SOA enablement. I

  • [solved] couldn't get NX work after switching to 64 bit system

    I switched the system to 64 bit with my "home" folder untouched. Then I couldn't get NX work. Here is the detailed output: NX> 203 NXSSH running with pid: 4866 NX> 285 Enabling check on switch command NX> 285 Enabling skip of SSH config files NX> 285

  • Why does the iPhone not have expandable memory (i.e. MicroSD Chips)?

    I know that many phones come with a MicroSD slot to come with the phone, but why does Apple NOT provide a slot for the iPhone. I would like to know the answer to this hardware puzzle, because many competing phones have these advantages. The only upsi

  • ITunes Not Showing Artist

    Hi there, Something weird is going on with my iTunes... I have a Jackson 5 album imported, but it doesn't seem to show up under artists. The only way it shows up is if I actually search for Jackson 5. There isn't any other way to find it. You can see