Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:54 PM
SyrU
Guest
 
Posts: n/a
Default 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.



  #2  
Old July 19th, 2005, 02:54 PM
Coz
Guest
 
Posts: n/a
Default Re: OnClick Question

You seem to be confusing a client side event (onClick) with server side
script.

"SyrU" <dthmtlgod@hotmail.com> wrote in message
news:u4k0HBHjEHA.2652@TK2MSFTNGP15.phx.gbl...[color=blue]
> 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.
>
>
>[/color]


  #3  
Old July 19th, 2005, 02:54 PM
Curt_C [MVP]
Guest
 
Posts: n/a
Default Re: OnClick Question

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" <dthmtlgod@hotmail.com> wrote in message
news:u4k0HBHjEHA.2652@TK2MSFTNGP15.phx.gbl...[color=blue]
>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.
>
>
>[/color]


  #4  
Old July 19th, 2005, 02:55 PM
SyrU
Guest
 
Posts: n/a
Default Re: OnClick Question

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:O94OVLHjEHA.712@TK2MSFTNGP09.phx.gbl...[color=blue]
> 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" <dthmtlgod@hotmail.com> wrote in message
> news:u4k0HBHjEHA.2652@TK2MSFTNGP15.phx.gbl...[color=green]
> >I have the below code. I am trying to send information to a subroutine,[/color][/color]
I[color=blue][color=green]
> > 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.
> >
> >
> >[/color]
>
>[/color]


  #5  
Old July 19th, 2005, 02:55 PM
Ray Costanzo [MVP]
Guest
 
Posts: n/a
Default Re: OnClick Question

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" <dthmtlgod@hotmail.com> wrote in message
news:%23etnSgIjEHA.1776@TK2MSFTNGP15.phx.gbl...[color=blue]
> 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[/color]
value[color=blue]
> to another page?.
>
>
> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> news:O94OVLHjEHA.712@TK2MSFTNGP09.phx.gbl...[color=green]
> > 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" <dthmtlgod@hotmail.com> wrote in message
> > news:u4k0HBHjEHA.2652@TK2MSFTNGP15.phx.gbl...[color=darkred]
> > >I have the below code. I am trying to send information to a[/color][/color][/color]
subroutine,[color=blue]
> I[color=green][color=darkred]
> > > 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.
> > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


  #6  
Old July 19th, 2005, 02:55 PM
SyrU
Guest
 
Posts: n/a
Default Re: OnClick Question

Yes, it does. Thanks Ray


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eo%23yhSKjEHA.644@tk2msftngp13.phx.gbl...[color=blue]
> It can be the same page, different page, different server, different[/color]
site -[color=blue]
> 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,[/color]
but[color=blue]
> 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" <dthmtlgod@hotmail.com> wrote in message
> news:%23etnSgIjEHA.1776@TK2MSFTNGP15.phx.gbl...[color=green]
> > 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[/color]
> value[color=green]
> > to another page?.
> >
> >
> > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> > news:O94OVLHjEHA.712@TK2MSFTNGP09.phx.gbl...[color=darkred]
> > > the event is CLIENT side, your code is SERVER side, they can't[/color][/color][/color]
interact.[color=blue][color=green][color=darkred]
> > > 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" <dthmtlgod@hotmail.com> wrote in message
> > > news:u4k0HBHjEHA.2652@TK2MSFTNGP15.phx.gbl...
> > > >I have the below code. I am trying to send information to a[/color][/color]
> subroutine,[color=green]
> > I[color=darkred]
> > > > 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.
> > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles