Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > ASP button does not work when running from the script?

Reply
Thread Tools

ASP button does not work when running from the script?

 
 
esoroka@gmail.com
Guest
Posts: n/a
 
      05-23-2005
Hello,

Trying to run a script what start ASP button:

document.Form1.all["btnNewPassUpdate"].click();

It is work one time only. Next script ignore it. Where can be
problem???

A full script is as follows:
<script language="javascript" type="text/javascript">
function ChangePass(NewPass)
{
var windowsize
"center:yes;dialogHeight:230px;dialogWidth:430px;t oolbar:no;menubar:no;status:no;directories:no;scro llbars:no;location:no;resizable=no";

var retVal;
NewPass = window.showModalDialog("ChangePassword.aspx?","",w indowsize);
if(NewPass !== "")
{
document.Form1.all["txbNewPass"].value = NewPass;
return document.Form1.all["btnNewPassUpdate"].click();
}
else return false;
}
</script>

Thanks,
eugene

 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      05-24-2005
In article <(E-Mail Removed) .com>,
http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us with...
> Hello,
>
> Trying to run a script what start ASP button:
>
> document.Form1.all["btnNewPassUpdate"].click();
>


You might want to get used to document.getElementById instead of
document.all.

> It is work one time only. Next script ignore it. Where can be
> problem???


A script error halting execution. Do you have MSIE set to display all script
errors? When developing, you should.

>
> A full script is as follows:
> <script language="javascript" type="text/javascript">
> function ChangePass(NewPass)
> {
> var windowsize
> "center:yes;dialogHeight:230px;dialogWidth:430px;t oolbar:no;menubar:no;status:no;directories:no;scro llbars:no;location:no;resizable=no";
>


Missing an equal sign for assignment or something. Typo?
The above makes no sense.

> var retVal;
> NewPass = window.showModalDialog("ChangePassword.aspx?","",w indowsize);
> if(NewPass !== "")


!== ?
That is not valid as far as I know for javascript. You want != instead.

> {
> document.Form1.all["txbNewPass"].value = NewPass;
> return document.Form1.all["btnNewPassUpdate"].click();


Um, what's that supposed to do?
Click is void.
Syntax
object.click()
Return Value
No return value.

Are you mixing up vb and javascript syntax and operators, perhaps?

--
--
~kaeli~
I love God. It's His fanclub that I can't stand.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
 
 
 
esoroka@gmail.com
Guest
Posts: n/a
 
      05-24-2005
Ok. Thank you for the answer. Some remarks:
1. Do you have MSIE set to display all script errors?
No. Where can I get it? URL please. Thank you.
2. You might want to get used to document.getElementById instead of
document.all.
It does not matter because script can found the button. When I put
alerts before/after
this line it showed me that alert and also showed that object:
all["btnNewPass*Update"]
Moreover it perfectly worked before.
2. return document.Form1.all["btnNewPass*Update"].click(); Um, what's
that supposed to do?
It supposed to click a small ASP button. When I click it manually my
ASP code work well. But it ignore it in script in runtime. I also
tried the case like this:
document.Form1.all["ASPbtnName"].click();
return true;
same thing...

 
Reply With Quote
 
Random
Guest
Posts: n/a
 
      05-24-2005
I've also had some finicky behavior trying to use .click() methods.
Fortunately they're generally not necessary, so in general I work
around them.

If all you want is to submit the form, use the .submit() method of your
form element. If you want to call the onclick event handler for your
button, do so manually, then submit the form if appropriate.



(E-Mail Removed) wrote:
> Ok. Thank you for the answer. Some remarks:
> 1. Do you have MSIE set to display all script errors?
> No. Where can I get it? URL please. Thank you.
> 2. You might want to get used to document.getElementById instead of
> document.all.
> It does not matter because script can found the button. When I put
> alerts before/after
> this line it showed me that alert and also showed that object:
> all["btnNewPass*Update"]
> Moreover it perfectly worked before.
> 2. return document.Form1.all["btnNewPass*Update"].click(); Um, what's
> that supposed to do?
> It supposed to click a small ASP button. When I click it manually my
> ASP code work well. But it ignore it in script in runtime. I also
> tried the case like this:
> document.Form1.all["ASPbtnName"].click();
> return true;
> same thing...


 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      05-28-2005
(E-Mail Removed) wrote:

> Ok. Thank you for the answer. Some remarks:
> 1. Do you have MSIE set to display all script errors?
> No. Where can I get it? URL please. Thank you.
> [and so on]


<http://jibbering.com/faq/>


PointedEars
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: The Submit button on ASP.NET pages does not work Grant Merwitz ASP .Net 1 08-23-2005 11:16 AM
asp.net button does not work nicholas ASP .Net 4 03-18-2005 04:36 PM
Power button does not turn OFF? New power supply does not help! win2k lbbss Computer Support 0 01-06-2005 04:03 PM
ASP - Form redirect to same page - BACK button does not work ??? Hugo Botha ASP General 1 07-11-2004 02:39 PM
Webservice works once and then DOES NOT seem to work even though program does not crash Phi! ASP .Net Web Services 1 04-23-2004 08:42 AM



Advertisments