Re: AJAX-Calling JavaScript function

Hello!
So i've been reading abt AJAX and i'm trying it out now. I have a problem or two.
Take a look @ this scenario plz.
I have a Page HTML header with the the following script
<script language="JavaScript1.1" type="text/javascript">
function setFocus(PageItem) {
document.getElementById(PageItem).focus();
function validateLogin(User,Pwd) {
alert("Here Now.");
if (document.getElementById(User).value == "") {
alert("Login ID must have a value provided.");
document.getElementById(User).focus();
else if (document.getElementById(Pwd).value == "") {
alert("Password must have a value provided.");
document.getElementById(Pwd).focus();
document.getElementById(Pwd).select();
else {
doSubmit('SUBMIT');
</script>
I have a button which is supposed to call the validateLogin function . In its' Optional URL Redirect, ive set Target=URL
and URL Target as
javascript:validateLogin('P4_USERNAME','P4_PASSWORD);
however when i run the page and try to press the button, i get "Error on page" at the bottom left hand corner of my browser.
Also, u notice i put an alert
alert("Here Now.");
just @ the beginning of the function to see if the function is actually called but the alert didn't even get displayed.
Am i calling my function wrongly. Hope i've explained the scenario ok. Any ideas on this plz.
big thnx

Hello,
You're missing a quote at the end of 'P4_PASSWORD.... So try
javascript:validateLogin('P4_USERNAME','P4_PASSWORD');
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-)

Similar Messages

  • How to call javascript function in back bean of jsf

    hi,
    i am trying to call java script function in back bean but not done. Is there any code for call javascript function in bean file.

    Java runs at server side.
    JSF produces HTML output.
    Server sends HTML output to client.
    Java stops running.
    HTML runs at client side.
    JS starts to run in HTML.
    Clear? Java is a server side language. JS is a client side language. To run JS using JSF, simply print it out to the HTML so that it get invoked when the HTML runs.

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • How to call javascript function in Flash

    Please help...
    I have a site that run multiple of domain for example
    Domain (A): raymond.com
    Domain (B): raymond.ca
    The problem is this.. when (B) html page load the flash file
    that locate at (A) it load but non of the buttons work which call
    javascript function using getURL("javascript:showpopup()"); But it
    work fine if all reside on the same domain,eg( (A) html page load
    flash file form (A)). Anyone know how to solve this other than
    create a set of flash files on (B).
    Regards,
    Raymond

    http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00001750.html

  • Call javascript function dynamically

    Can this be done to call Javascript function dynamically? What I mean is suppose I use Javascript to submit form and target the reply to a popup window:
      function cForm() {
         win=window.open('','myWin','toolbars=0');
         document.aForm.q.value='12345';     
         document.aForm.target='myWin';
         document.aForm.submit();
      }I target the form reply to popup window myWin. Suppose the reply body contains some Javascript function doX(). Is it possible to call doX() automatically, after the submit and the reply is loaded on myWin, maybe using some onload event in the popup window?

    On the PopUo Windows BODY onLoad, call the method doX()

  • Call javascript function after submit process

    Hi,
    How can I call javascript function after my submit process ?
    Thanks.

    Hi Carl,
    You say that I must have an Item or region that contains my js with conditionnal display. With this method I can execute my js with specific request value.
    My problem is that I tried to integrate the "save large value workaround" in my application with the APEX wysiwyg (fckeditor). To do that I have to call the javascript function clob_submit on the save button. This function save the value of my field but if I want to save other item value, how can I do that ?
    If I use your method, I will submit the page, save the other field and after that, I will branch on the same page. At this moment, I will execute my javascript file.
    Is it what did you said ?
    Sylvain Michaud
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

  • How can i call javascript function with out internet connection?

    I have trying to call javascript function through ExternalInterface. But flash player recomonding to have internet connectivity. i have allredy used allowscript="always" .

    first, allow the folder that contains your flash files to connect to the internet by adjusting your security settings:
    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.ht ml
    then try the following in a swf and open the published html in your browser to test:
    import flash.external.ExternalInterface
    ExternalInterface.call("function(){alert('test');}")

  • Call JavaScript function from Acrobat Plugin

    Hi All,
    I want to call JavaScript function from Acrobat Plugin? Where is to write JavaScript function in Acrobat SDK? Please reply..
    Thanks in advance..

    Hi Malkyt,
    Thanks.. where is to write JavaScript code in the application..
    function GetWelcome()
    alert("Welcome");
    this above code. how to use this javascript code to plugin application.
    static ACCB1 ASBool ACCB2 AVPageViewMouseClick (AVPageView pageView, AVDevCoord xhit, AVDevCoord yhit, AVFlagBits16 flags, AVTCount clickNo, void *data)
    char jsscript[200];
    AFExecuteThisScript (pddoc, jsscript, NULL);
    i want to display welcome message of JS file.. give me step to perform above task.. Please reply...

  • IPad = webStageView = HTML = call javascript function thru Flash

    Has anyone loaded a HTML file thru webStageView, and then been able to call javascript functions embeded in the HTML through flash.
    I've seen references to using webStageViewBRIDGE but I think that has been depreciated.
    Below is a link to a Adobe tutorial doing this with the htmlLoader class and FLEX.
    Cross-scripting PDF content in an Adobe AIR application
    http://www.adobe.com/devnet/air/flex/quickstart/articles/scripting_pdf.html
    If anyone has successfully been able to do this on the iPad, could you explain how it's done or provide a link to some documentation.
    Thanks...

    Stagewebviewbridge is a 3rd party library (not an official Adobe product). It looks like it is still supported. The technique described should work even if the library isn't being actively developed.
    http://code.google.com/p/stagewebviewbridge/wiki/Communication
    Also, note that most techniques which use the HTMLLoader class will not work with the StageWebView class -- they are entirely different beasts. (Well, to be precise, on desktop computers, StageWebView uses the same Webkit code, but the interface to it is still very different.)

  • ADF: Can i call javascript function from java clsss method in ADF?

    Hi,
    I want to call javascript function in Java class method, is it possible in ADF? , if yes then how?
    or I need to use Java 6 feature directely?
    Regards,
    Deepak

    private void writeJavaScriptToClient(String script)
    FacesContext fctx = FacesContext.getCurrentInstance();
    ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
    erks.addScript(fctx, script);
    }usage
    StringBuilder script = new StringBuilder();
    script.append( "var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');");
    script.append("if(popup != null){"); script.append("popup.show();"); script.append("}");
    writeJavaScriptToClient(script.toString());Timo

  • How to call javascript function & action method on clicking jsf  button?

    I have one jsf custom button. I am checking client side validations in mail by calling javascript function & also sending mail by calling action method of a bean which will execute at server side for onclick event of that button. Because of this when I click on that button its calling both javascript function and action method. So even though validations failed its sending mail. How can I overcome this problem?? Please help me....

    I am asking regarding commanLinks in jsf. I have the following code block in jsf. Even though mailSentMessage('true'); returns false, its calling action="#{emailObjectAction.sendEmail}" method. thats why I got that doubt. try the following code.
    <h:commandLink id="mailBtn123Send"      onclick="return mailSentMessage('true');" value="send mail"     action="#{emailObjectAction.sendEmail}">          
    </h:commandLink>

  • About use mouse middle key to call JavaScript function question

    I want use mouse middle key to call JavaScript function (<a href="javascript:help()">) help() will open a new Window and direct to my GUI Help Page but when I click it with middle key ,it will open new Tab blank Page that url="javascript:help()"; can not Executive help function... Is this a Firefox Bug or correct behavior in Firefox? thank.

    You need to use a left click to handle JavaScript links.
    See also http://kb.mozillazine.org/browser.link.open_newwindow.restriction

  • How to call javascript function?

    Hi,
    How to call javascript function for SAP button
    control onclick event?
    Thanks in advance.

    Hi Sundar,
      u can call java script  in design mode.
      Add this code in ur design part inside body and call the function as
    <sap:button id="a" onSelect="javascript:go();"
    Add inside body:
      <script language="javascript>
    function go(){
    alert("hai");
      </script>
    Regards,
    Vinoth.M

  • How to call javascript function when form load[like onload="fun()" in html]

    I have to call javascript function at the time of iview is loading. I am not able use onload event which is not working in SAP Portal environment. Please suggest me any other alternative to call the function at the time of iview is loading. I have to set some properties when form is loading.

    I will explain my scenario correctly
    Let us take two pages
    1. Main Page (A)
    2. Child page (B)
           I have displayed records in tableview and each having checkbox and two buttons "print" and "viewDetails"  at down in page A. If I clicked "print" button the records which i have selected checkboxes details will be displayed in new window( page B). In page B i have given this following code
      <script language="javascript">
          window.opener.setTarget('Search');
      </script>
    setTarget() function is in page A.
    function setTarget(opt) {
      if(opt=='print')
         opt="";     
         document.<%=strFormControl%>.target="_blank";
       else
            document.<%=strFormControl%>.target="_self";
    This code is executing after the content of all records details displayed.
    My condition is If i click print button new window is opened and details are displaying. And before displaying content in new page B (means after opened new window) if i click on "viewDetails" button that is also opening new window because <script> code is not executed not yet. but it should display in same window when i click "viewDetails" button.

  • Calling javascript function to open SWF

    When the Captivate presentation ends, I'm trying to open
    another SWF in the same browser window.
    I have put the following code in the HTML document:
    <script type="text/javascript">
    <!--
    function changeMovie(filename)
    document.getElementById('Captivate1').movie=filename;
    alert(document.getElementById('Captivate1').movie);
    //-->
    </script>
    I am able to call the function from the Captivate file
    successfully because the alert window pops up with the name of the
    movie. I just can't get it to play. Can anyone help me on this?
    Not to be rude or anything, but I should note that:
    1) this is not my idea--it is my boss' idea, and any attempts
    to tell me that this is something not worth doing will
    unfortunately fall, not on deaf ears, but on ears connected to
    hands that have no freedom to choose how this project is completed.
    This is my master's bidding, and I must do what he says.
    2) I know very little JavaScript. This code was given to me
    by another guy on the project. So if you have advice for changing
    the code, please be as specific as possible.
    I would be very grateful for any help that you can
    offer.

    Two non javascript methods:
    Movie End Options -> Action ->> Open URL or file
    Button -> On Success ->> Open URL or file
    A method to load a new movie without completly reloading the
    page.
    1. Create two 200x200 movies - m1 and m2 - add some content.
    2. Create a button in m1 set Exectue Javascript ->>
    loadMovie('m2.htm');
    3. Publish html and swfs to the same folder.
    4. Open m1.htm and replace all the code with the following
    (up to and including </html>):
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8">
    <title>m1</title>
    <script type="text/javascript">
    var xmlHttp
    function loadMovie(url)
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    alert ("Browser does not support HTTP Request")
    return
    xmlHttp.onreadystatechange=stateChanged
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    function stateChanged()
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    document.getElementById("movieContainer").innerHTML=xmlHttp.responseText
    function GetXmlHttpObject()
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    objXMLHttp=new XMLHttpRequest()
    else if (window.ActiveXObject)
    objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    return objXMLHttp
    </script>
    </head>
    <body>
    <div id="movieContainer">
    <!-- captivate generated code -->
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    width="200" height="200" id="Captivate1" align="middle">
    <param name="allowScriptAccess" value="sameDomain">
    <param name="movie" value="m1.swf">
    <param name="quality" value="high">
    <param name="menu" value="false">
    <param name="loop" value="0">
    <param name="bgcolor" value="#f3f3f3">
    <embed src="m1.swf" name="Captivate1" quality="high"
    bgcolor="#f3f3f3" width="200" height="200" name="menu"
    align="middle" allowScriptAccess="sameDomain" loop="0"
    type="application/x-shockwave-flash" menu="false" pluginspage="
    http://www.macromedia.com/go/getflashplayer">
    </object>
    <!-- end Captivate code -->
    </div>
    </body>
    </html>
    5. Open m2.htm and replace the code with the following:
    <!-- Captivate generated code -->
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    width="200" height="200" id="Captivate1" align="middle">
    <param name="allowScriptAccess" value="sameDomain">
    <param name="movie" value="m2.swf">
    <param name="quality" value="high">
    <param name="menu" value="false">
    <param name="loop" value="0">
    <param name="bgcolor" value="#f3f3f3">
    <embed src="m2.swf" name="Captivate1" quality="high"
    bgcolor="#f3f3f3" width="200" height="200" name="menu"
    align="middle" allowScriptAccess="sameDomain" loop="0"
    type="application/x-shockwave-flash" menu="false" pluginspage="
    http://www.macromedia.com/go/getflashplayer">
    </object>
    <!-- end Captivate generated code -->
    6. Open m1.htm in you browser, click the button to load m2
    How it works:
    Simply put AJAX lets you load parts of an html file in the
    current window. The code to be replaced is within the div
    id="movieContainer". The code in the file you want to load should
    be only the code you need, not an entire HTML file.
    Call it from Captivate with loadMovie('URL') where URL is the
    name of the html file.

Maybe you are looking for

  • How do I delete the on my Mac calendar as it is competing with the iCloud calendar and giving me an error message

    I am getting an error ménage in my iCloud calendar that says I can't add an event it must revert to the server . How can I delete the on my Mac calendar because I think it is competing with the iCloud calendar ?

  • Templates updating on local server but not on remote in DW CS3

    I'm using Dreamweaver CS3 and am trying to update some templates.  At first, when I checked out the file on the remote server, made the change and saved, it asked me if I want to upload to all pages using that template.  I said yes, and it checked th

  • Window hang

    Recently I had installed a new harddisk to my computer.But I faced a big problem is my computer will automatically hang once the window came out.It looked like some loading can't operate well.Can anyone please give me some advise.Thanks 1.intel celer

  • Unable to Start OBIEE 11g Presentation Server

    Hello All, I am trying to Start the OBIEE 11g (11.1.1.6) Services. Checked EM, Presentation Server is showing Down. Not Started. Tried to Restarted the particular service alone, but no use. Getting the below error messages... Module - oracle.sysman.e

  • Recovery media for qosmio x775

    Hi!! I have a toshiba qosmio X775, mistakenly deleted the recovery of the HHD, and try to buy the recovery media to DVD or USB but I can not buy on the website of Toshiba ...  need help getting the recovery media on DVD, but any help me and will offe