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
- <script language="JavaScript">
- function confirmDelete(){
- alert(document.ha); //<------------here shows undefined
- // but alert(document) shows
- isDelete = confirm("Are you sure you want to delete?");
- if(isDelete == false){
- document.ha.re1.value="0";
- alert(document.ha.re1.value);
- }else{
- alert(document.ha.re1.value);
- document.ha.re1.value="1";
- }
- alert(document.ha.re1.value);
- document.ha.submit();
- }
- confirmDelete();
- </script>
- <form name="ha" action="./ldapDeleteUserExec.php" method="post">
- <input type="hidden" name="re1" value=""></input>
- <input name="authority" type="hidden" value="$authority" ></input>
- <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)
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.