|
 |
asp_web_howto thread: Error on passing arg on OnClick event
Message #1 by williams@s... on Wed, 22 Aug 2001 18:39:07 -0400
|
|
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #2 by "Gerhard Wentink" <data@w...> on Thu, 23 Aug 2001 06:27:10 +0200
|
|
Isn't that a javascript errormessage? Somewhere in your NewReport function?
Try also placing the attributes within quotation marks.
Regards
Gerhard Wentink
----- Original Message -----
From: <williams@s...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Thursday, August 23, 2001 12:39 AM
Subject: [asp_web_howto] Error on passing arg on OnClick event
>
> Hi all,
>
> Need quick help for the following html + ASP code:
>
> <input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
> ("SN") %>, <%= oRS.Fields("PN") %>)>
>
> got error message for missing ']'
>
> There is no error when I deleted the arguments as:
>
> <input type="button" name="butCSN<%= n %> onclick=NewReport()>
>
> Thanks
> William
>
>
Message #3 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 23 Aug 2001 10:05:31 +0100
|
|
what type of arguments does the function expect, strings or numbers?
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: 22 August 2001 23:39
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #4 by "Drew, Ron" <RDrew@B...> on Thu, 23 Aug 2001 07:50:21 -0400
|
|
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters but
if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds like
a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #5 by "Tim Morford" <tmorford@n...> on Thu, 23 Aug 2001 08:29:18 -0400
|
|
I think this should work ok.
New_Report = oRS.Fields("SN"),oRS.Fields("PN")
<input type="button" name="butCSN<%= n %>
onclick=NewReport.value(<%=New_Report%>)>
The .value is important.
Tim
-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Thursday, August 23, 2001 7:50 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters but
if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds like
a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #6 by williams@s... on Thu, 23 Aug 2001 08:44:54 -0400
|
|
Tim,
I got following error message
Error Type:
Microsoft VBScript
compilation
(0x800A0401)
Expected end of
statement
I don't understand the concatenation of New_Report in your code, then I
changed it to
New_Report = oRS.Fields("SN")+","+oRS.Fields("PN")
After the change, I got original error message: expected ']'
William
"Tim Morford"<tmorford@n...>
To: "ASP Web HowTo" <asp_web_howto@p...>
cc:
Subject:[asp_web_howto] RE: Error on passing arg on OnClick event
08/23/2001 08:29 AM
I think this should work ok.
New_Report = oRS.Fields("SN"),oRS.Fields("PN")
<input type="button" name="butCSN<%= n %>
onclick=NewReport.value(<%=New_Report%>)>
The .value is important.
Tim
-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Thursday, August 23, 2001 7:50 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but
if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds like
a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #7 by williams@s... on Thu, 23 Aug 2001 08:47:14 -0400
|
|
Well it is an error messsage from Internet Expolorer.
I tried double quote but got same error: expected ']'
<input type="button" name="butCSN<%= n %>" onclick="NewReport(<%
oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)">
I tried
Response.Write " <input type=button name=butCSN" & n & " onclick=NewReport
(" & oRS.Fields("SN") & ", " & oRS.Fields("PN") & ")>"
but this time got syntax error
Any idea?
William
------------------------
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds
like a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #8 by "Tim Morford" <tmorford@n...> on Thu, 23 Aug 2001 09:53:08 -0400
|
|
<input type="button" name="butCSN<%=n%>" onclick="NewReport.value
'<%=oRS.Fields("PN")%>,<%=oRS.Fields("SN")%>';">
See if that works ok for you
Tim
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 8:47 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Well it is an error messsage from Internet Expolorer.
I tried double quote but got same error: expected ']'
<input type="button" name="butCSN<%= n %>" onclick="NewReport(<%
oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)">
I tried
Response.Write " <input type=button name=butCSN" & n & " onclick=NewReport
(" & oRS.Fields("SN") & ", " & oRS.Fields("PN") & ")>"
but this time got syntax error
Any idea?
William
------------------------
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds
like a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #9 by "Drew, Ron" <RDrew@B...> on Thu, 23 Aug 2001 09:55:33 -0400
|
|
the key here may be you are missing the VALUE
onclick="NewReport.value(blah.blah)"
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 8:47 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Well it is an error messsage from Internet Expolorer.
I tried double quote but got same error: expected ']'
<input type="button" name="butCSN<%= n %>" onclick="NewReport(<%
oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)">
I tried
Response.Write " <input type=button name=butCSN" & n & " onclick=NewReport
(" & oRS.Fields("SN") & ", " & oRS.Fields("PN") & ")>"
but this time got syntax error
Any idea?
William
------------------------
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds
like a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #10 by williams@s... on Thu, 23 Aug 2001 10:13:14 -0400
|
|
It got no error after deleting the ; from your input statement. Thanks.
I don't understand the .value in the statement. Would you mind explain.
When I click on button , i got error message : type mismatch :
'newreport'
William
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
<input type="button" name="butCSN<%=n%>" onclick="NewReport.value
'<%=oRS.Fields("PN")%>,<%=oRS.Fields("SN")%>';">
See if that works ok for you
Tim
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 8:47 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Well it is an error messsage from Internet Expolorer.
I tried double quote but got same error: expected ']'
<input type="button" name="butCSN<%= n %>" onclick="NewReport(<%
oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)">
I tried
Response.Write " <input type=button name=butCSN" & n & " onclick=NewReport
(" & oRS.Fields("SN") & ", " & oRS.Fields("PN") & ")>"
but this time got syntax error
Any idea?
William
------------------------
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds
like a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #11 by "Tim Morford" <tmorford@n...> on Thu, 23 Aug 2001 10:34:06 -0400
|
|
<input type="button" name="butCSN<%=n%>" onclick="NewReport.value
'<%=oRS.Fields("PN")%>,<%=oRS.Fields("SN")%>';">
<input name="NewReport" value="">
the .value is to say the value of NewReport = the string of variables. So if
NewReport is a input box then the value will = PN,SN or you can make it like
<input type="hidden" name="NewReport" value="">
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 10:13 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
It got no error after deleting the ; from your input statement. Thanks.
I don't understand the .value in the statement. Would you mind explain.
When I click on button , i got error message : type mismatch :
'newreport'
William
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
<input type="button" name="butCSN<%=n%>" onclick="NewReport.value
'<%=oRS.Fields("PN")%>,<%=oRS.Fields("SN")%>';">
See if that works ok for you
Tim
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 8:47 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Well it is an error messsage from Internet Expolorer.
I tried double quote but got same error: expected ']'
<input type="button" name="butCSN<%= n %>" onclick="NewReport(<%
oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)">
I tried
Response.Write " <input type=button name=butCSN" & n & " onclick=NewReport
(" & oRS.Fields("SN") & ", " & oRS.Fields("PN") & ")>"
but this time got syntax error
Any idea?
William
------------------------
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds
like a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
Message #12 by williams@s... on Thu, 23 Aug 2001 10:32:56 -0400
|
|
Message #13 by "Drew, Ron" <RDrew@B...> on Thu, 23 Aug 2001 11:41:25 -0400
|
|
With the value option, you either send the value in the onClick or use the
value when you get to the function itself. Here is an example of editing
the name on a form to exist. I am testing the value without passing it as a
parameter here.
function CheckForm() {
if (document.formname.elementname.value == "")
{
alert("Please enter a value for the \"Name\" field.");
document.formname.elementname.focus();
return (false);
}
}
Here is another way to use value....
<INPUT NAME="username" SIZE=30 MAXLENGTH=40
onBlur="javascript:while(''+this.value.charAt(this.value.length-1)=='')this.
value='No@E... Specified';">
Here is another passing the parameter and testing its value ... the onBlur
validate(this) is the value of the parameter....
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Start the script
function validate(field) {
var valid = "abcdefghijklmnopqrstuvwxyz0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only characters and numbers are accepted!");
field.focus();
field.select();
}
}
// End -->
</script>
</HEAD>
<BODY>
<form onSubmit="blah..blah">
<input type=text name="entry" onBlur="validate(this)">
<br>
<input type=submit value="Submit Form">
</form>
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 10:13 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
It got no error after deleting the ; from your input statement. Thanks.
I don't understand the .value in the statement. Would you mind explain.
When I click on button , i got error message : type mismatch :
'newreport'
William
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
<input type="button" name="butCSN<%=n%>" onclick="NewReport.value
'<%=oRS.Fields("PN")%>,<%=oRS.Fields("SN")%>';">
See if that works ok for you
Tim
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Thursday, August 23, 2001 8:47 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Error on passing arg on OnClick event
Well it is an error messsage from Internet Expolorer.
I tried double quote but got same error: expected ']'
<input type="button" name="butCSN<%= n %>" onclick="NewReport(<%
oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)">
I tried
Response.Write " <input type=button name=butCSN" & n & " onclick=NewReport
(" & oRS.Fields("SN") & ", " & oRS.Fields("PN") & ")>"
but this time got syntax error
Any idea?
William
------------------------
Looks like a javascript problem...show us the NewReport function. You can
also debug the function by changing your script to hardcode 2 parameters
but if onclick=NewReport() works and onclick=NewReport(A,B) doesnt..sounds
like a javascript problem.
-----Original Message-----
From: williams@s... [mailto:williams@s...]
Sent: Wednesday, August 22, 2001 6:39 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Error on passing arg on OnClick event
Hi all,
Need quick help for the following html + ASP code:
<input type="button" name="butCSN<%= n %> onclick=NewReport(<%= oRS.Fields
("SN") %>, <%= oRS.Fields("PN") %>)>
got error message for missing ']'
There is no error when I deleted the arguments as:
<input type="button" name="butCSN<%= n %> onclick=NewReport()>
Thanks
William
|
|
 |