OnClick Question

Discussion in 'ASP General' started by SyrU, Aug 27, 2004.

  1. SyrU

    SyrU Guest

    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.
     
    SyrU, Aug 27, 2004
    #1
    1. Advertising

  2. SyrU

    Coz Guest

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

    "SyrU" <> wrote in message
    news:...
    > 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.
    >
    >
    >
     
    Coz, Aug 27, 2004
    #2
    1. Advertising

  3. SyrU

    SyrU Guest

    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:...
    > 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" <> wrote in message
    > news:...
    > >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.
    > >
    > >
    > >

    >
    >
     
    SyrU, Aug 27, 2004
    #3
  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" <> wrote in message
    news:%...
    > 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:...
    > > 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" <> wrote in message
    > > news:...
    > > >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.
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Ray Costanzo [MVP], Aug 28, 2004
    #4
  5. SyrU

    SyrU Guest

    Yes, it does. Thanks Ray


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:eo%...
    > 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" <> wrote in message
    > news:%...
    > > 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:...
    > > > 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" <> wrote in message
    > > > news:...
    > > > >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.
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    SyrU, Aug 29, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. EMW

    OnClick event question

    EMW, Jul 2, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,848
  2. Chad
    Replies:
    4
    Views:
    8,400
  3. bob
    Replies:
    3
    Views:
    211
  4. Replies:
    2
    Views:
    272
  5. Replies:
    4
    Views:
    197
Loading...

Share This Page