473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

document hierarchy problem

I want to transfer a value "re1" to ldapDeleteUserExec.php

The "alert(document.ha)" appears a dialog and shows "undefined."
The "alert(document)" shows "object"

But there seems some problem:
The error msg said "document.ha.re1" is null or not a object
and can't transfer to the ldapDeleteUserExec.php

My friend told me that may be a DOM(Document Object Model) problem.
He said it maybe lack of some tags

Can anyone give me some suggestions.
Thanks a lot

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2. function confirmDelete(){
  3. alert(document.ha);     //<------------here shows undefined
  4. // but alert(document) shows
  5. isDelete = confirm("Are you sure you want to delete?");
  6.  
  7. if(isDelete == false){
  8. document.ha.re1.value="0";
  9. alert(document.ha.re1.value);
  10. }else{
  11. alert(document.ha.re1.value);
  12. document.ha.re1.value="1";
  13. }
  14. alert(document.ha.re1.value);
  15. document.ha.submit();
  16. }
  17. confirmDelete();
  18. </script>
  19.  
  20. <form name="ha" action="./ldapDeleteUserExec.php" method="post">
  21. <input type="hidden" name="re1" value=""></input>
  22. <input name="authority" type="hidden" value="$authority" ></input>
  23. <input name="dealedUserName" type="hidden" value="$dealedUserName"
  24. </input>
  25. </form>
  26.  
The whole php file is in http://nopaste.snit.ch:8001/1864
(although it's a php file, but I guess the problem is about html and
javascript)

Jul 23 '05 #1
4 1595
ji********@gmail.com wrote:
I want to transfer a value "re1" to ldapDeleteUserExec.php

The "alert(document.ha)" appears a dialog and shows "undefined."
The "alert(document)" shows "object"

But there seems some problem:
The error msg said "document.ha.re1" is null or not a object
and can't transfer to the ldapDeleteUserExec.php

My friend told me that may be a DOM(Document Object Model) problem.
He said it maybe lack of some tags

Can anyone give me some suggestions.
Thanks a lot

Expand|Select|Wrap|Line Numbers
  1.   <script language="JavaScript">
  2.     function confirmDelete(){
  3.           alert(document.ha);     //<------------here shows undefined
  4.                                    // but alert(document) shows
  5.        isDelete = confirm("Are you sure you want to delete?");
  6.        if(isDelete == false){
  7.             document.ha.re1.value="0";
  8.             alert(document.ha.re1.value);
  9.        }else{
  10.           alert(document.ha.re1.value);
  11.           document.ha.re1.value="1";
  12.        }
  13.        alert(document.ha.re1.value);
  14.        document.ha.submit();
  15.     }
  16.      confirmDelete();
  17.   </script>
  18.    <form name="ha" action="./ldapDeleteUserExec.php" method="post">
  19.      <input type="hidden" name="re1" value=""></input>
  20.      <input name="authority" type="hidden" value="$authority" ></input>
  21.      <input name="dealedUserName" type="hidden" value="$dealedUserName"
  22. </input>
  •    </form>
  •  

  • The whole php file is in http://nopaste.snit.ch:8001/1864
    (although it's a php file, but I guess the problem is about html and
    javascript)

    I'm a newbie with javascript though I'm not doing to bad with it... and
    I have some php experience... I don't know where the problem is but this
    is what I would do to help pin point a solution:

    First - I cannot see how your function confirmDelete gets called - So I
    cannot see how you get any alert boxes in the first place...

    Second... if you do get alert boxes, then you've left out something...
    so this is one thing I would do:

    I would swap the following around: alert(document.ha.re1.value);
    document.ha.submit(); so as to look like: document.ha.submit();
    alert(document.ha.re1.value);

    Then retry and check if you are getting a value in the alert box...

    If that fails you then try this...

    Change your hidden input tag to a visable box (ie type=text as opposed
    to tpye=hidden)

    Change it so that your form posts to a new php script that contains a
    single command - call it testdump.php

    <?
    phpinfo();
    ?>

    Now re-run your form, manually enter a value into your now visable box
    re1 and submit it - Then examine the output of phpinfo() and see if you
    can find what you manually entered.

    What you have done above is pretty basic and I believe should work (but
    obviously it isn't or you wouldn't have posted). I'm wondering if
    you've neglected to include a line or two of code somewhere...I've had a
    quick look at the url you gave me and that didn't tell me much else...

    Since I'm eight or nine hours behind you, I'm afraid I'm off to bed now
    so I won't be able to check again until morning - I hope something above
    helps you forward... or that someone else in this ng helps you along the
    way...

    Cheers
    Randell D.
    Jul 23 '05 #2
    On 17 Feb 2005 21:27:43 -0800, in comp.lang.javascript
    ji********@gmail.com wrote:
    | I want to transfer a value "re1" to ldapDeleteUserExec.php
    |
    | The "alert(document.ha)" appears a dialog and shows "undefined."
    | The "alert(document)" shows "object"
    |
    | But there seems some problem:
    | The error msg said "document.ha.re1" is null or not a object
    | and can't transfer to the ldapDeleteUserExec.php
    Does using document.ha.re1.value help?
    | My friend told me that may be a DOM(Document Object Model) problem.
    | He said it maybe lack of some tags
    |
    | Can anyone give me some suggestions.
    | Thanks a lot
    |
    |
    Expand|Select|Wrap|Line Numbers
    1. |  <script language="JavaScript">
    2. |    function confirmDelete(){
    3. |          alert(document.ha);     //<------------here shows undefined
    4. |                                   // but alert(document) shows
    5. |       isDelete = confirm("Are you sure you want to delete?");
    6. |
    7. |       if(isDelete == false){
    8. |            document.ha.re1.value="0";
    9. |            alert(document.ha.re1.value);
    10. |       }else{
    11. |          alert(document.ha.re1.value);
    12. |          document.ha.re1.value="1";
    13. |       }
    14. |       alert(document.ha.re1.value);
    15. |       document.ha.submit();
    16. |    }
    17. |     confirmDelete();
    18. |  </script>
    19. |
    20. |   <form name="ha" action="./ldapDeleteUserExec.php" method="post">
    21. |     <input type="hidden" name="re1" value=""></input>
    22. |     <input name="authority" type="hidden" value="$authority" ></input>
    23. |     <input name="dealedUserName" type="hidden" value="$dealedUserName"
    24. | ></input>
    25. |   </form>
    |
    | The whole php file is in http://nopaste.snit.ch:8001/1864
    | (although it's a php file, but I guess the problem is about html and
    | javascript)


    ---------------------------------------------------------------
    jn******@yourpantsyahoo.com.au : Remove your pants to reply
    ---------------------------------------------------------------
    Jul 23 '05 #3
    ji********@gmail.com wrote:
    I want to transfer a value "re1" to ldapDeleteUserExec.php

    The "alert(document.ha)" appears a dialog and shows "undefined."
    The "alert(document)" shows "object"

    But there seems some problem:
    The error msg said "document.ha.re1" is null or not a object
    and can't transfer to the ldapDeleteUserExec.php

    My friend told me that may be a DOM(Document Object Model) problem.
    He said it maybe lack of some tags

    Can anyone give me some suggestions.
    Thanks a lot

    Expand|Select|Wrap|Line Numbers
    1.   <script language="JavaScript">
    2.     function confirmDelete(){
    3.           alert(document.ha);     //<------------here shows undefined
    4.                                    // but alert(document) shows
    5.        isDelete = confirm("Are you sure you want to delete?");
    6.        if(isDelete == false){
    7.             document.ha.re1.value="0";
    8.             alert(document.ha.re1.value);
    9.        }else{
    10.           alert(document.ha.re1.value);
    11.           document.ha.re1.value="1";
    12.        }
    13.        alert(document.ha.re1.value);
    14.        document.ha.submit();
    15.     }
    16.      confirmDelete();
    17.   </script>
    18.    <form name="ha" action="./ldapDeleteUserExec.php" method="post">
    19.      <input type="hidden" name="re1" value=""></input>
    20.      <input name="authority" type="hidden" value="$authority"
    21. </input>
    22.      <input name="dealedUserName" type="hidden"
  • value="$dealedUserName"
  •  ></input>
  •    </form>
  •  

  • The whole php file is in http://nopaste.snit.ch:8001/1864
    (although it's a php file, but I guess the problem is about html and
    javascript)

    Imagine you were a parser, reading the file in question.

    When you got to:

    alert(document.ha);

    ....how would you know what 'document.ha' was? Sure, there's a Document
    (object), created when the file began loading, but the <form
    name="ha"...> isn't created until down below (after) the script runs.
    Try pasting it *above* the script block for a better outcome.

    No closing tag for <input>. Hmm...why submit anything at all if the
    delete is aborted? This operation is typically done like so:

    <form name="ha"
    action="./ldapDeleteUserExec.php"
    method="post"
    onsubmit="return confirm('Are you sure you want to delete?')">
    ................
    ................
    <input type="submit" value="delete" />

    Jul 23 '05 #4
    thanks RobB
    I moved the form to the *above* of the script block, and the script can
    see the document.ha

    -jiing-

    Jul 23 '05 #5

    This thread has been closed and replies have been disabled. Please start a new discussion.

    Similar topics

    0
    by: Trevor Andrew | last post by:
    Hi There, I was wanting some advice regarding the best-practice approach to representing a hierarchy in XML. Let me explain by an example of the two different approaches I have seen. In the...
    0
    by: archway | last post by:
    Hi, I would like to build a hierarchy of ProductNode objects like so ProductNode ---Product Node ---ProductNode ------ProductNode ------ProductNode ---ProductNode
    12
    by: Charles Law | last post by:
    Hi guys A bit of curve ball here ... I have a document (Word) that contains a series of instructions in sections and subsections (and sub-subsections). There are 350 pages of them. I need to...
    4
    by: Wow | last post by:
    when calling a object in an html, should I use self.objectname this.objectname or document.objectname? for example, i have a form called theform and a link called thelink i can call...
    2
    by: Yaro | last post by:
    Hi All (UDB 8.1 FP8, Win) In my simple test database, I have two tables CREATE TABLE "DB2ADMIN"."AAA" ( "F1" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY, "F2" VARCHAR(10), PRIMARY KEY...
    4
    by: Dave Veeneman | last post by:
    I have an object hierarchy that's several layers deep, and I'm puzzling over how to access an object at any point in the hierarchy, solely by its key. The hierarchy is similar to an...
    21
    by: Mark Broadbent | last post by:
    Consider the following statements //------- Item i = Basket.Items; //indexer is used to return instance of class Item Basket.Items.Remove(); //method on class item is fired item i = new...
    2
    by: Do | last post by:
    Hi, I have a database table with the following fields: id, name, parentid. These fields are supposed to create a hierarchy for a list box, an infinite hierarchy Child fields of parent fields...
    10
    by: John Nagle | last post by:
    Here are three network-related exceptions. These were caught by "except" with no exception type, because none of the more specific exceptions matched. This is what a traceback produced: 1....
    0
    by: Charles Arthur | last post by:
    How do i turn on java script on a villaon, callus and itel keypad mobile phone
    0
    by: emmanuelkatto | last post by:
    Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
    1
    by: nemocccc | last post by:
    hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
    0
    marktang
    by: marktang | last post by:
    ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
    0
    jinu1996
    by: jinu1996 | last post by:
    In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
    0
    by: Hystou | last post by:
    Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
    0
    tracyyun
    by: tracyyun | last post by:
    Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
    0
    agi2029
    by: agi2029 | last post by:
    Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
    0
    isladogs
    by: isladogs | last post by:
    The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

    By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

    To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.