473,322 Members | 1,714 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,322 software developers and data experts.

OnClick Question

I have the below code. I am trying to send information to a subroutine, I
am getting an Object Required Error.

<input type="button" name="pSearch" value="Search"
onclick="DisplayRecords()">

Then in my ASP page I have this

Sub DisplayRecords()

dim conn
dim strsql
dim mycount

....
....

End Sub

I think I am doing this correctly.

Jul 19 '05 #1
5 1597
Coz
You seem to be confusing a client side event (onClick) with server side
script.

"SyrU" <dt*******@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I have the below code. I am trying to send information to a subroutine, I
am getting an Object Required Error.

<input type="button" name="pSearch" value="Search"
onclick="DisplayRecords()">

Then in my ASP page I have this

Sub DisplayRecords()

dim conn
dim strsql
dim mycount

...
...

End Sub

I think I am doing this correctly.

Jul 19 '05 #2
the event is CLIENT side, your code is SERVER side, they can't interact.
You'll have to post to the server and process from there.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"SyrU" <dt*******@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I have the below code. I am trying to send information to a subroutine, I
am getting an Object Required Error.

<input type="button" name="pSearch" value="Search"
onclick="DisplayRecords()">

Then in my ASP page I have this

Sub DisplayRecords()

dim conn
dim strsql
dim mycount

...
...

End Sub

I think I am doing this correctly.

Jul 19 '05 #3
Hmmm, thanks didn't realize that. Is there any another way I can have a
user click on a button and run a sub routine or do I have to pass the value
to another page?.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:O9*************@TK2MSFTNGP09.phx.gbl...
the event is CLIENT side, your code is SERVER side, they can't interact.
You'll have to post to the server and process from there.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"SyrU" <dt*******@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I have the below code. I am trying to send information to a subroutine, I am getting an Object Required Error.

<input type="button" name="pSearch" value="Search"
onclick="DisplayRecords()">

Then in my ASP page I have this

Sub DisplayRecords()

dim conn
dim strsql
dim mycount

...
...

End Sub

I think I am doing this correctly.


Jul 19 '05 #4
It can be the same page, different page, different server, different site -
it doesn't matter. But, regardless, you'll have to hit a server again.
Example:
<%
If Request.Querystring("x") = "1" Then
Response.Write "Okay, NOW the code in here will run..."
'''code, code, code
End If
%>
<button onclick="location.href+='?x=1'">Run a sub</button>
See, instead of calling a sub from your button, you call the page again, but
pass something in the querystring that can tell your SERVER-side code that
it should do something. Does that make sense at all?

Ray at home

"SyrU" <dt*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hmmm, thanks didn't realize that. Is there any another way I can have a
user click on a button and run a sub routine or do I have to pass the value to another page?.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:O9*************@TK2MSFTNGP09.phx.gbl...
the event is CLIENT side, your code is SERVER side, they can't interact.
You'll have to post to the server and process from there.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"SyrU" <dt*******@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I have the below code. I am trying to send information to a
subroutine,
I am getting an Object Required Error.

<input type="button" name="pSearch" value="Search"
onclick="DisplayRecords()">

Then in my ASP page I have this

Sub DisplayRecords()

dim conn
dim strsql
dim mycount

...
...

End Sub

I think I am doing this correctly.



Jul 19 '05 #5
Yes, it does. Thanks Ray
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eo***************@tk2msftngp13.phx.gbl...
It can be the same page, different page, different server, different site - it doesn't matter. But, regardless, you'll have to hit a server again.
Example:
<%
If Request.Querystring("x") = "1" Then
Response.Write "Okay, NOW the code in here will run..."
'''code, code, code
End If
%>
<button onclick="location.href+='?x=1'">Run a sub</button>
See, instead of calling a sub from your button, you call the page again, but pass something in the querystring that can tell your SERVER-side code that
it should do something. Does that make sense at all?

Ray at home

"SyrU" <dt*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hmmm, thanks didn't realize that. Is there any another way I can have a
user click on a button and run a sub routine or do I have to pass the

value
to another page?.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:O9*************@TK2MSFTNGP09.phx.gbl...
the event is CLIENT side, your code is SERVER side, they can't interact. You'll have to post to the server and process from there.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"SyrU" <dt*******@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
>I have the below code. I am trying to send information to a

subroutine,
I
> am getting an Object Required Error.
>
> <input type="button" name="pSearch" value="Search"
> onclick="DisplayRecords()">
>
> Then in my ASP page I have this
>
> Sub DisplayRecords()
>
> dim conn
> dim strsql
> dim mycount
>
> ...
> ...
>
> End Sub
>
> I think I am doing this correctly.
>
>
>



Jul 19 '05 #6

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

Similar topics

8
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function...
1
by: Will | last post by:
(My 4 questins at end after explination) The code below was provided to me to "Popup" a window explaining what a Credit Card Verification Number is and where to find it on a card... it is used as...
3
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement...
2
by: Will | last post by:
(My 4 questins at end after explination) The code below was provided to me to "Popup" a window explaining what a Credit Card Verification Number is and where to find it on a card... it is used as...
2
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } ...
2
by: jrsjrs | last post by:
The "filetest.txt" contents is here .................. one/yes two/no three/maybe four/fun five/ok ................ The main program is here
11
by: Daz | last post by:
Hello everyone. I am sure the answer to my question is simple, but I can't seem to dynamically add an onClick event to my script. I have a table which is generated dynamically, I am just...
10
by: Carlos Araya | last post by:
I have the following link on a web page <p class="menuitem"><a href="#" onclick="loadFragment('http://rivendellweb.net/fortress/home', 'index')" title="The Fortress Home">The Fortress...
2
by: =?Utf-8?B?TWFyaw==?= | last post by:
I am writing a control and want to handle an OnClick event on the client-side before then conforming to the postback mechanism. I have got the server-side events working for my OnClick event by...
1
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.