Javascript: getElementByID does not work on the pop up pages?

I have two pages that call the same pop up page to get values chosen by the users. Once the value is chosen, a passBack function is called. I tried to use the getElementID to decide which is the calling page. However, it didn't work at all. The code is given as follows:
< script language="JavaScript" >
function passBack(passVal1)
if opener.document.getElementById("P8_search")==NULL
opener.document.getElementById("P6_name").value = passVal1;
opener.document.getElementById("P6_name").focus();
close();
else
opener.document.getElementById("P8_name").value = passVal1;
opener.document.getElementById("P8_name").focus();
close();
</script>
Can somebody kindly enough tell me where is wrong? Thanks in advance.

Rather late reply... but posting it for the reference of other users...
In my experince "if" is generally clumsy with javascript. Try avoiding it.
When u call the popup function instead, in the url, pass the name of the item to the called page. Eg. say 6 and 8 are your base pages. And u r calling - say page 70 (popup page)
Poup function -
<script language="JavaScript" type="text/javascript">
function callPopup (formItem1) {
var formVal1 = document.getElementById(formItem1).value;
var url;
url = 'f?p=&APP_ID.:70:&APP_SESSION.::::P70_X: <if calling page is 8 - give the name of the item on page8, else name of item on page 6 > ' + formVal1;
w = open(url,"winLov","Scrollbars=1,resizable=1,width=400,height=400");
if (w.opener == null)
w.opener = self;
w.focus();
</script>
So on your popup page, u have an element which holds the page it came from. (6 or 8)
Further, during passback - passback function :
<script language="JavaScript">
function passBack(passVal1,passElem1)
opener.document.getElementById(passElem1).value = passVal1;
close();
</script>
passelem1 will hold the name of the element on your base page.(which gets populated with the value from the popup)
On the report link that passes back the value, pass this as an additional param :
$x('P70_X').value
P70_X will store the name of the item on the callin page which collects the calue from the popup.

Similar Messages

  • Some javascript code does not work out in a .jspx page

    To the experienced:
    I am trying to improve some pages in my application. In one of the pages, there are only two elements in the form: an input box (for user to put in his username) and a submit button. What I am trying to do are:
    1. Make the input box be in focus when the page is loaded, so that the user can start typing right away without having to fumble for the mouse and than click the input for it to get focus.
    2. After the user has typed the username, pressing the Enter key to submit the form instead of fumbling for the mouse again and click hte submit button.
    These are not difficult to do. I wrote a test page, and the following are the snippets from the test page:
    <pre>
    &lt;body <b>onload="document.getElementById('username').focus();"</b>&gt;
    &lt;form method="post" action="http://host.domain.edu/pages/staffLogin.jspx"&gt;
    &lt;table&gt;
    &lt;tr&gt;&lt;td&gt;UID:&lt;/td&gt;&lt;td&gt;&lt;input <b>id="username"</b> type="text" name="LoginName"&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="submit" value="Submit"&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
    &lt;/form&gt;
    &lt;/body&gt;
    </pre>
    This page does the two things that I want to accomplish, in both Internet Explorer and FireFox. I do not need to add any code for the Enter key to act for the submit button - it behaves that way by default.
    But not in the page of my application, with the snippets here:
    <pre>
    &lt;f:view&gt;
    &lt;afh:html ...&gt;
    &lt;afh:head ...&gt;
    &lt;script type="text/javascript"&gt;<b>self.resizeTo(900,1000);</b>&lt;/script&gt;
    &lt;meta .../&gt;
    &lt;/afh:head&gt;
    &lt;afh:body binding="#{staffLogin.body1}" id="body1" <b>onload="document.getElementById('inputText1').focus();"</b>&gt;
    &lt;af:inputText binding="#{staffLogin.inputText1}" secret="true" <b>id="inputText1"</b>
    required="true" requiredMessageDetail="Password required."
    value="#{staffLogin.submittedPassword}"
    <b>onkeydown="if(event.keyCode == 13) document.getElementById('commandButton1').click();"</b>/&gt;
    &lt;af:commandButton text="Submit"
    binding="#{staffLogin.commandButton1}" <b>id="commandButton1"</b>
    action="#{staffLogin.commandButton1_action}"/&gt;
    </pre>
    What do I do not right? Is DOM recognized in .jspx? Note that the <code>self.resizeTo(900,1000);</code> part works.
    Many thanks!
    Newman

    Hi,
    use af:document instead of afh:html (etc.)
    http://download.oracle.com/docs/cd/B25221_05/web.1013/e18745/tagdoc/core/document.html
    initialFocusId       
    the id of the component to which you want the focus to be when the full page renders. The accessibility-mode must be set to "inaccessible" for this feature to be on. This attribute is not supported on the following agent types: pda, phone, voice.
    Use af:form to define the form
    http://download.oracle.com/docs/cd/B25221_05/web.1013/e18745/tagdoc/core/form.html
    defaultCommand       
    The id attribute of the command button whose action would be invoked by default for form submit on hitting enter on any of the input fields of the form.
    You don't need JavaScript at all!
    Frank

  • I have an event in my calendar that was sent by someone who does not work for the company anymore and I am reminded 2 times a week. How can I remove it?

    I have an event in my calendar that was sent by someone that does not work for the company anymore and I am reminded 2 times a week. How do I delete it?

    Tap on the event to open the event. Click the 'Edit' button in the event bubble, then press the 'Delete Event' button at the bottom of the Edit pop-up. It's a little different for events that come through Microsoft Exchange, you tap the event to bring up bubble and click the 'Details' button, and then press 'Decline' to remove the event.

  • TS1702 When I update to IOS6 on my 4S Facebook does not work properly, the news feed never updates it only says no new storeys and shows a picture of an antenna. When I reset my phone and go back to IOS5 Facebook works fine. What's up with IOS6 ????

    When I update my iPhone 4S to iOS six Facebook does not work properly the newsfeed doesn't load properly and I can never see what's going on all I see is a picture of an antenna and a little thing underneath it says no new stories when I reset my phone back to iOS 5 then it works just fine and I don't have any issues so there must be something wrong with iOS six that isn't letting Facebook load properly

    No I did not use any unauthorized methods for anything, I simply reset my phone back to factory.
    <Edited By Host>

  • I get this error when I go to imovie, I have instalerat on via appstore, but it does not work. The QuickTime components necessary to view, edit, import and export various types of films are not installed. The components included in the iMovie installer. R

    I get this error when I go to imovie, I have instalerat on via appstore, but it does not work.
    The QuickTime components necessary to view, edit, import and export varioustypes of films are not installed. The components included in the iMovie installer.Reinstalling iMovie.

    I get this error when I go to imovie, I have instalerat on via appstore, but it does not work.
    The QuickTime components necessary to view, edit, import and export varioustypes of films are not installed. The components included in the iMovie installer.Reinstalling iMovie.

  • HT204187 Email account does not work on the Mac but works on my iPad and iPhone. The account information was added on the Mac. I keeps rejecting my password.

    I have seral email accounts on my Mac. One does not work on the Mac but works on my iPad and iPhone. The account information was added on the Mac. I keeps rejecting my password.

    You don't input the information in manually for iCloud mail. It is automatically set up for you when you sign into iCloud via System Preferences and choose the Mail checkbox. Sign out of iCloud or deselect Mail in iCloud preferences. Open Mail's preferences and choose accounts tab. If iCloud account still exists in the list, delete it. Sign back into iCloud or check the box for mail. The account will be auto created for you.

  • I just bought an Iphone4 from straight talk and my camera does not work. The shutter wont open and when it does open there is a black screen. I am very upset. I have wanted this phone for awhile and now that I have it, it does not work properly. Need help

    I just bought an Iphone 4 from straight talk. My camera does not work. The shutter does not open and when it does open there is a black screen. I am very upset. I have wanted this phone for awhile. I want the issue fixed.
                                                                                                                                                     Thanks

    Take the iPhone to an Apple store genius bar for testing, and if it is defective and under warranty they will replace.  Since you say iPhone 4, was this a used or refurbished iPhone? 

  • Short key for copy does not work all the time now.

    After I have installed the latest OSX - Yosemite, my short key for copy does not work all the time.  It is infrequent how it works. I'm using the same keyboard that I have always used, my wireless logitech keyboard for mac.  Please help.

    I've plugged in my default mac keyboard and the short key copy still does not work.

  • I have an apple ID which I use to sign into icloud for my iPad and iPhone.But when I use the same ID for setting up iCloud on my Macbook it says INCORRECT ID or password, try again. I tried changing my passwords but it does not work for the macbook.

    I have an apple ID which I use to sign into icloud for my iPad and iPhone.But when I use the same ID for setting up iCloud on my Macbook it says INCORRECT ID or password, try again. I tried changing my passwords several times but it does not work for the macbook.

    You will have to provide the correct password to delete the existing account, if you have tried but are not getting the password reset email, contact Apple for assistance by going to https://expresslane.apple.com, then click More Products and Services>Apple ID>Other Apple ID Topics>Lost or forgotten Apple ID password.

  • I was running KeyPassFox with Firefox 8.0.1, but the plugin does not work in the new release (9) . Is there a way to restore my previous version with all of my bookmarks intact? I do not mind if I have to restore the plugins myself.

    I was running KeyPassFox with Firefox 8.0.1, but the plugin does not work in the new release (9) . Is there a way to restore my previous version with all of my bookmarks intact? I do not mind if I have to restore the plugins myself.
    The plugin shows on the list as enabled and functioning, yet the tool does not show on the toolbar. It would appear that I need to restore the previous version of Firefox and wait until a newer release of the plugin is available before upgrading the browser.

    I copied the iTunes file from the external drive and it's in both places.  I thought all I would need is the iTunes program (which I downloaded to new computer) and my iTunes library file.  There must be something else that's missing.  My iTunes library looks the same on the new computer as it does when I open it on the external drive.  If I click on an iTunes library song from my new computer, it will only play if I have the external drive plugged in.
    My back-up drive is a mess.  I have multiple copies of music, video, photo, and document files and I don't know how that happened. ={  Obviously, I don't know how to back up stuff properly and there are back-up files extending over a 6- to 8-year period.  I think all I did was just drag and drop the main folders from the back-up drive to the same main folders on the C: drive.  Also (and I'm kind of fuzzy on this) Windows used to automatically save music files in a folder within my document files (which makes no sense to me).  As my Jewish friends would say, "Oy Vey!" 

  • Ralink RT5390 Does Not Work on the UEK Kernel

    We installed OL6.3 and Ubuntu 12.04 on a new Asus X45A notebook. It has a Ralink RT5390 wireless card. With Ubuntu, both wifi and video work flawlessly. However, the wifi driver (from elrepo) does not work for the the uek kernel (2.6.39). While the wifi driver works when boot into the RHEL kernel (2.6.32), it created an "even bigger problem" in that the video starts at about 1/10 from the left edge of the screen.
    As a result, we can only boot into Ubuntu on this new notebook, but we would like to use the uek kernel. Any suggestion will be appreciated.

    Dude wrote:
    It wouldn't surprise me if was more power efficient because half your hardware, e.g. wireless apparently isn't working ;-) I have three notebooks running OL6. Wireless works on all three of them. (One of the notebooks its wireless has problem with the UEK kernel, but no problem with the RHEL kernel.)
    However, power management support means computer sleep and idle functions to slow down your computer's power
    consumption when it is not needed, e.g. down clock your CPU and slow down your hardware, dim your screen, etc.
    when running on battery, etc.This needs further verification, but all these functions seem to be working with OL6.
    But again, please no one be fooled by my overly optimistic and simplistic comments*. The reality is, I am glad OL6 desktop works at all.
    * For example, I actually installed OL6 on 4 notebooks, one of them "does not work" because I couldn't dim the screen. I did not intend to lie, but subconsciously, I somewhat forgot that there was this failed case.
    Edited by: Ping-Wu on Dec 19, 2012 7:48 AM

  • My back button does not work because the prior screen does not appear in the history.  I therefore must go back to the blue screen and reload safari.  Apple tech support could not help.  Can anyone else help?

    After I installed mountain lion my back button frequently does not work because the prior screen does not appear iunder History.  Apple tech support was not able to fix the problem.  Does anyone have any suggestions?

    lbryan1987 wrote:
    I dont want the button problem solved i need to know how to restore the phone without using that button or going into settings
    You don't in the condition it's in. You will either have to get the phone replaced by Apple or pay a 3rd party to repair it.
    there seriously should be more than two ways to solve this other wise apple is useless and we will never buy another apple product.
    Seriously? It's physically broken!

  • When a pdf file is opened in a tab, the automatic scroll function from the pad does not work in the other tabs, but only for the particular PDF tab.

    The scroll function from the pad/mouse does not work for the other tabs when a PDF file is opened.

    Hi NSHS,
    Have you checked to see if your PDF add-on is up to date? You should take a look at the [[Opening PDF files within Firefox]] Knowledge Base article. There is a lot of good information in there. You should try both of the suggested PDF add-ons to see if that fixes the issue.
    Hopefully this helps!

  • I wanted to send a push notification, unfortunately it does not work. The page will not load. Anyone know why?

    I wanted to send a push notification, unfortunately it does not work. The page will not load. Anyone know why?

    Push notifications, I believe, is only for iOS.
    If it is for iOS, take a look at Using Apple push notifications with Digital Publishing Suite | Adobe Developer Connection

  • Fast dial (visual bookmarks) does not work with the new 5.0 upgrade. How do I correct this issue

    fast dial (visual bookmarks) does not work with the new 5.0 upgrade. How do I correct this issue Asked this question yesterday. I desperately need info, will I ever be able to use fast dial again?

    I tried it and it WORKED....I even tried the other version BEFORE this one and it didn't work so I tried yours and it worked like a charm so THANKS brother....

Maybe you are looking for

  • Digital output went out after I upgraded...

    My Apple TV was working correctly. Until the software update... Did the software update, and now I don't get a signal from the digital out connector. Already: - checked Settings -> Audio/Video -> Dolby Digital Out. It was on. - used the same cable wi

  • Select data from  view ( V_T856 ).

    Hi All, i need to download transaction type and text from V_T856 ,  but the data is not selected from V_T856 view. how to select data from a view, is there any special conditions. i declared V_T856 in tables statement, even though select statement no

  • What needs to be done to rebuild a current Sharepoint 2010 Server farm to work as a Sharepoint 2013 Server farm?

    Hello Community     Currently I have a Sharepoint 2010 Server farm.     One server contains the database and DNS server because it is the the domain controller.     The other server Contains the Sharepoint 2010 Server software and is the the applicat

  • Click wheel frozen while docked

    All of a sudden, after 7 mos of no problems, my 3rd gen nano click wheel will no longer work while docked to my dock at home or in the car. I have been using it with both for at least 4 months and have never had this problem. I have tried both types

  • Why would Framemaker add an extra page to my document ?

    Hi everyone, I have a mif file here that is used to generate a ONE PAGE pdf and for a reason that I don't know, when I open this .MIF file in FRAMEMAKER, there is a second page using default masterpage that is automatically added by FrameMaker. The .