ADF Javascript problem: cannot get id of an component

hi, am currently reading and executing examples from ADF faces Web UI Developers Guide for jdeveloper 11g.
i am trying to execute example 3-7
I have a <af:commandButton> component , whose id i want to display in an alert box.
However i am unable to display it
here is the sample code i made up:
<f:view>
<af:document title="hello from component" >
<af:form >
<af:commandButton text="show id" id="cmdbutton">
<af:clientListener method="sayHello" type="action"/>
</af:commandButton>
</af:form>
<f:facet name="metaContainer">
<trh:script>
<f:verbatim>
function sayHello(actionEvent)
var component= actionEvent.getSource();
//Get the ID for the component
var id = component.getId ;
alert("Hello from " + id);
</f:verbatim>
</trh:script>
</f:facet>
</af:document>
</f:view>
Problem 1: when i run it, the alert box displays: Hello from undefined . i was expecting Hello from cmdButton
Problem 2: in the line var id = component.getId, if i modify it as var id = component.getId() (just added the parentheses after method getId)
no alert box is displayed. in javascript when a method accepts no parameters, its ok to call it with or without parentheses. why no alert
box displayed when i add parentheses to getId.

in javascript calling a method with or without parentheses is OK , then why the alert box in one case and no alert box in another?
Because your assumption is wrong. Calling a function can only be done with the parenthesis. When you're not using them then you get a pointer on the function. For example:
MyNamespace = new Object();
MyNamespace.myUtilFunction = function()
    return "Hello world";
alert(MyNamespace.myUtilFunction);
alert(MyNamespace.myUtilFunction());The first alert will show something like
"function()
return "Hello world";
While the second will print "Hello world". Furthermore, if a function does not exists, like "MyNamespace.myUnexistingFunction" then the first alert would show "undefined" while the second would never even pop as there would be an "MyNamespace.myUnexistingFunction is undefined" error. Consequently, if the alert is not showing with the parenthesis then I guess getId is not a valid function on UIComponent which is possible, I assumed there would be one because there's an id property, but then again, that id would not be very useful on the client side compared to the client id.
Regards,
~ Simon

Similar Messages

  • Homesharing problems cannot get past sign in

    Always having problems with the homesharing on apple tv.  States turn on home sharing but it is already on.  Brings up the log in and we cannot get past the sign in.

    Hello maxfromchesapeake,
    Welcome to Apple Support Communities.
    Sorry to hear about your difficulties with Home Sharing on your Apple TV. You can start with this article to troubleshoot Home Sharing:
    Troubleshooting Home Sharing
    http://support.apple.com/kb/TS2972
    Regards,
    Jeff D.

  • IMessage problem - Cannot get it to work

    iMessage problem - I cannot get iMessage to sync. I have a iPhone 4 and iPad 2 both on iOS 5. everything else works fine. I cannot get the iMessage to sync. Both have the same @me id. if I try to add another email I get "iMessage Activation Unable to veryify email because it is already in use." Going crazy for 2 days any ideas?

    I'm guessing, but the email address is used as a unique address, (it's easier with an iPhone as it has a phone number). This error could be saying that another iTunes userid has linked with that email address.  That is only possible if they verified it.
    Do you have two AppleIDs / iTunes IDs in the house, but a family (shared) email address?
    Simple solution then would be to create a new gmail email address and use that.

  • P35 NEO2-FR startup problems, cannot get into BIOS

    Hello!
    So i recently bought new parts for my computer:
    CPU: Intel Core 2 Duo E8500 3.16GHz 1333Mhz
    Motherboard: MSI P35 NEO2-FR
    RAM: 2x Corsair TWIN2X 2048MB 6400 DDR2
    PSU: Corsair Powersupply 550W (3.3v/30A, 5v/28A, 12V/41A)
    Graphics Card: GeForce 7800 gtx (this part was not new, so i dont have any more details for it)
    I start up my computer with only the CPU, graphics card and one RAM module installed, and a keyboard attached to the ps2 slot (using a converter) for simplicity. The problem is that the computer freezes up when the MSI screen comes up, and i cannot get into the BIOS. The LED lights on the motherboard is indicating the state "Testing base and extended memory". And b/c i go straight into the MSI start-up screen i am unable to find out what BIOS version i am running, though i am fairly sure (i have talked with another person that bought the same motherboard from the same shop as me at about the same time, and he is running BIOS v1.8) that it is 1.8 and it is therefore compitable with my cpu. I have also tried several different types of RAM with the same results. I am also very certain that i have all the cables plugged in correctly (have also tried resetting CMOS ALOT of times) but still the same result.
    Does anyone have any clue what could be the problem ?

    Quote
    i am unable to find out what BIOS version i am running
    Have a look at the sticker on the BIOS Chip of the board to check the factory BIOS Version.  The following picture shows the location of the chip on your board (it is actually a P35 Platinum, but it has the same PCB as the P35 Neo2-FR):
    Quote
    CPU: Intel Core 2 Duo E8500 3.16GHz 1333Mhz
    If you have an E8500, E0 (and not an E8500, C0) you will need BIOS v1.9 [A7345IMS.190] to have full support for your processor.  You can identify your processor model by checking its sSpec number (on the CPU itself or on the box):
    E8500, C0 ---> sSpec#=SLAPK {Supported since BIOS v1.6 [A7345IMS.160]}
    E8500, E0 ---> sSpec#=SLB9K  {Supported since BIOS v1.9 [A7345IMS.190]}

  • ADF Javascript problem

    <af:clientListener method="Clickheretoprint('content')" type="click"/>
    function Clickheretoprint(id)
    alert(id);
    this javascript is called on page load.
    But i want to call this javascript on button click.

    duplicate of ADF Javascript problem

  • [Problem] Cannot get TS_EngineCommitGlobalsToDisk to work (TestStand 3.5)...

    I have CVI based DLL that displays a panel for operator entered values.  I then store these in a StationGlobal structure.  It seems that the actual ini file is not updated unless you complete the sequence.  If terminate it, it does not get the latest memory version of the StationGlobals.  I found the function TS_EngineCommitGlobalsToDisk and added the following function to my DLL which I then call after the panel has closed:
    void  CommitInformation (int promptOnSaveConflicts,
                             CAObjHandle seqContextCVI,
                             char *reportText,
                             short *errorOccurred,
                             long *errorCode,
                             char errorMsg [1024])
      int error = 0;
      ERRORINFO errorInfo;
      ErrMsg errMsg = {'\0'};
      tsErrChk (TS_EngineCommitGlobalsToDisk (seqContextCVI, &errorInfo, (VBOOL)promptOnSaveConflicts));
    Error:
      // If an error occurred, set the error flag to cause a run-time error in TestStand.
      if (errorInfo.wCode < 0)
        *errorOccurred = TRUE;
        *errorCode = errorInfo.wCode;
        sprintf (errorMsg,
                 "Source     : %s\n"
                 "Description: %s\n",
                 errorInfo.source,
                 errorInfo.description);
    Now when it runs "error" contains a massive negative number, but errorInfo does not contain any errors.  The StationGlobals are also not saved.  What am I doing wrong?
    Christopher Povey
    Senior Test Systems Engineer for BAE Systems.
    Solved!
    Go to Solution.

    It looks like your problem was that you were passing a SequenceContext to an Engine method. You have to pass a handle to the Engine. If you don't have an Engine handle handy, you can always get it from the context.
    In general, the name of a CVI function for a TestStand method  is TS_<interface name><method name>, though in some cases the it might be abbreviated. As an example of abbreviation, TS_PropertyGetValBoolean is a method on the PropertyObject interface, there is no Property interface.

  • HT4623 please help - installed IOS7 and now I am having problems playing Words Free on my Iphone.  It gives me a pop up telling me to connect to ITunes but will not connect.  Cannot get out and have to continually shut down my phone and start over.

    please help - installed IOS7 and now I am having problems playing Words Free on my Iphone.  It gives me a pop up telling me to connect to ITunes but will not connect.  Cannot get out and have to continually shut down my phone and start over.

    Hi, jeantwin.
    Thank you for visiting Apple Support Communities.
    The steps in the article below may help you resolve the issue with push notifications.
    iPad and iPod touch: Unable to use YouTube or Push notifications
    http://support.apple.com/kb/ts3305
    If the issue persists, try signing out of your Apple ID and then sign back in.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311
    Cheers,
    Jason H.

  • I have a problem with my iPhone 4s.  An Apple rep looked at the phone today and determined the phone will have to be replaced.  I am trying to back up my data on the phone to iTunes but I cannot get the phone to power up.

    I have a problem with my iPhone 4s.  An Apple rep looked at the phone tonight and determined I will need a new phone.  I am now trying to back up my data to iTunes but I cannot get the phone to turn on.  I have it plugged into my computer monitor but it just slowly flashes the Apple symbol. Any ideas on how I can get it to power up for the backup?

    Apple isnt here. this is a user based forum for technical questions. The solution is to restart, reset, and restore as new which is in the manual after that get it replaced for hard ware failure. if your within your one year warranty its replaced if it is out of the warranty then it is 199$

  • I recently changed my aol password and now I cannot get mail.  When I go to settings, Mail, Contacts, Calendars the accounts portion is grayed out and will not let me open.  How do I fix this problem?

    I recently changed my aol password and right after I changed, I cannot get mail.  I get a a pop up block that says, Cannot Get Mail, the user name or password for AOL is incorrect, settings, OK.  I go to settings as suggested but the account area is grayed out and will not let me open.  Need help on how to fix this problem.  I tried sync with my PC and that did not help either.

    It sounds like you might need to contact Yahoo! if you aren't able to setup your email account as a new account after deleting it. 
    I found some links on the Yahoo! website that might help:
    http://help.yahoo.com/kb/index?page=content&id=SLN4138&locale=en_US&y=PROD_MOBIL E
    http://help.yahoo.com/kb/index?locale=en_US&y=PROD_MOBILE&page=content&id=SLN261 7

  • Cannot get Genius to work - Always get same error message - "Genius results can't be updated right now. The required file cannot be found."  Problem also seems to be affecting iCloud aand Music Match.

    Cannot get Genius to work - Always get same error message - "Genius results can't be updated right now. The required file cannot be found."  Problem also seems to be affecting iCloud aand Music Match. Can anyone help me with this?  What file is missing and from where?

    This is a known problem with Windows 7 Enterprise using certain Group Policy settings. Solution for me was to use another machine running Windows 7 Ultimate.

  • HT1277 why i cannot set up my exchange account into my iphone 4s.  everything that needs to input has been provided right, but error says cannot get email not connected to the srver.where seems to be the problem?pls help.btw,i have an outlook for macbook

    please help me find out the solution to the problem.
    My iphone 4S was not able to fetch mails from the server ( outgoing and incoming)
    I was trying to configure my exchange account and follow all the procedures correctly but am having trouble in sending and receiving mails as the error says " cant get mails cannot connect to the server?  where seems to be the problem?
    Have read from the support services that if you using a Pop3 account into another device which I did ( my email was configured via outlook for mac in my macbook) there might be a lock out problem and cannot get emails on the second device which is my iphone?  ( I want to set up my exchange account to my iphone so wherever and whenever i go i cant still access to my email easily. Please help.

    No one seems to be hearing what Big Q is saying.
    He can pair his iPhone to his Macbook, but cannot CONNECT. He's NOT asking for alternative solutions, like Wi Fi.
    I am able to both pair and connect my one one Macbook to my other one, but I can only pair but not connect my iPhone or iPad to either Macbook. So I have the same problem. But I can pair and connect my Macbooks to other Bluetooth devices, like my ancient Nokia cellfone, or my Bluetooth HP printer.
    It's irrelavent that I can instead use a direct USB cable or Wi Fi between my Macbooks and my iPhone/iPad - why can't I use Bluetooth? If Apple does not allow Bluetooth between it's Macbooks and other Mac devices, then why have Bluetooth at all? Does my iPhone have Bluetooth only so that I can pair and connect to my my non Apple mobile handsfree car kit, or communicate easily with the dreaded Apple enemy Samsung, or what?
    Make no mistake , I am a diehard Apple fan, but this Bluetooth non compatibility issue appears shortsighted and seemingly pointless. Why does Apple not just say why they created the non compatibility, or have a message on the Bluetooth setup programme which simply and clearly says "don't bother wasting hours of your time trying to pair and connect your iPhone to your Macbook, because we don't allow that anymore, reason being that............"?
    As a first time user of this Forum I am surprised at the intolerant and highhanded tone of some of the replies  to what is a legitimate question, that is obviously plagueing many, many other Apple users.

  • I have a problem with mail.  the spelling and grammer check box before sending the messege is no longer there.  I did everything but cannot get it back.  is ther anyone who knows how to get the box with spelling and grammer checks before sending

    i have a problem with mail.  the spelling and grammer check box before sending the messege is no longer there.  I did everything but cannot get it back.  is ther anyone who knows how to get the box with spelling and grammer checks before sending the mail.
    Also the mail is acting very funny by not getting the rules work in a proper method.  Is ther a software to repair mail.

    i did both of them, but still the while sending the mail the diolog box is not showing up and also the spelling and grammer does not do the spelling check. 
    This problem just started for about 3 to 4 days now.  earlier it was working normally.

  • I cannot get scrabble to work on my ipod touch.  I've uploaded, deleted, reloaded and nothing seems to work. It asks for a password but will not let me in.  Anyone else have this problem?

    I cannot get scrabble to work on my ipod touch. It only works on my macbook.  I've uploaded, deleted, reloaded and nothing seems to work. It asks for a password but will not let me in.  Anyone else have this problem?

    Hi BDAqua,
    I can go to /System/Library/Frameworks/, but JavaVM.framework/Versions/A/JavaVM does not exist!
    Hi Linc,
    I have already downloaded that updater, and it says 'A newer version of this package is already installed'

  • I have a new MacBook Pro with OS10.8.2 and cannot get Contacts to print a list of addresses with pictures showing.  There is a check box selecting "picture" which has been checked - but no picture.  This worked fine on OS10.7.5.  Problem??

    I have a new MacBook Pro with OS10.8.2 and cannot get Contacts to print a list of addresses with pictures showing.  There is a check box selecting "picture" which has been checked - but no picture.  This worked fine on OS10.7.5.  Problem??

    First, back up all data immediately, as your boot drive might be failing.
    There are a few other possible causes of generalized slow performance that you can rule out easily.
    Reset the System Management Controller.
    If you have many image or video files on the Desktop with preview icons, move them to another folder.
    If applicable, uncheck all boxes in the iCloud preference pane.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Check your keychains in Keychain Access for excessively duplicated items.
    If you have more than one user account, you must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way you launched Activity Monitor. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Select the 50 or so most recent entries in the log. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V). You're looking for entries at the end of the log, not at the beginning.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some personal information, such as your name, may appear in the log. Anonymize before posting. That should be easy to do if your extract is not too long.

  • I have a BTHub4 - My iMac, iPhone, and children's iPads all connect to the internet no problem. I cannot get my 2 MacBook Pros or my partners MacBook Air to connect. Have tried diagnostics - says to change DNS but  it is correct.

    I have a BTHub4 - My iMac, iPhone, and children's iPads all connect to the internet no problem. I cannot get my 2 MacBook Pros or my partners MacBook Air to connect. Have tried diagnostics - says to change DNS but  it is correct. I have re-set both router and all laptops - no joy. They can all see the network but cannot connect.

    This is extraordinary. I have moved the router and also tried resetting it to its factory strings.  We have had this router for over a year and all our devices have always worked. Now all four laptops will not connect to the internet. Only one oMac and our phones and iPad.
    I have had far more devices running at once before but now all laptops are timing out on connection. Some say this iIP address is already being used but if I manually set to a slightly different IP address it does not help, noir if I manually set to the correct IP address. Why would all our laptops (four) suddenly be unable to connect?

Maybe you are looking for