Referencing the value of a input field.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George Slamowitz

    Referencing the value of a input field.

    Hello all

    I have a HTML control generated by the following:

    INPUT TYPE="hidden" NAME="MyAnswer" VALUE=""

    Is there a way to reference the Value of this control using VB program code???

    Thanks in advance

    George

    From http://www.developmentnow.com/g/62_0...sp-general.htm

    Posted via DevelopmentNow. com Groups
    DevelopmentNow is an award-winning creative software development agency integrating mobile, web, hardware, mixed reality, and emerging technology.

  • Anthony Jones

    #2
    Re: Referencing the value of a input field.


    "George Slamowitz" <GSlamowitz@COX .NETwrote in message
    news:814b2e44-bcf4-41c6-af78-3e47b8f9a554@de velopmentnow.co m...
    Hello all
    >
    I have a HTML control generated by the following:
    >
    INPUT TYPE="hidden" NAME="MyAnswer" VALUE=""
    >
    Is there a way to reference the Value of this control using VB program
    code???
    >
    In what context?

    In an ASP page which is the action target of the FORM that contains this
    INPUT then by default it is accessed as:-

    Request.QuerySt ring("MyAnswer" )

    If the FORM in the html specifies METHOD="POST" then this would be:-

    Request.Form("M yAnswer")


    Thanks in advance
    >
    George
    >
    From
    http://www.developmentnow.com/g/62_0...sp-general.htm
    >
    Posted via DevelopmentNow. com Groups
    http://www.developmentnow.com

    Comment

    • George Slamowitz

      #3
      RE: Referencing the value of a input field.

      Anthony

      Are you saying that to set the value you would as

      "GET" - Request.Form("M yAnswer") = 1 or
      "POST" - Request.QuerySt ring("MyAnswer" ) = 1

      and freference the valuue as

      "GET" - Answer = Request.Form("M yAnswer") or
      "POST" - Answer = Request.QuerySt ring("MyAnswer" )

      George




      From http://www.developmentnow.com/g/62_2...put-field-.htm

      Posted via DevelopmentNow. com Groups
      DevelopmentNow is an award-winning creative software development agency integrating mobile, web, hardware, mixed reality, and emerging technology.

      Comment

      • Anthony Jones

        #4
        Re: Referencing the value of a input field.


        "George Slamowitz" <GSlamowitz@COX .NETwrote in message
        news:765e3954-bbf6-4f84-8415-878c33939681@de velopmentnow.co m...
        Anthony
        >
        Are you saying that to set the value you would as
        >
        "GET" - Request.Form("M yAnswer") = 1 or
        "POST" - Request.QuerySt ring("MyAnswer" ) = 1
        >
        and freference the valuue as
        >
        "GET" - Answer = Request.Form("M yAnswer") or
        "POST" - Answer = Request.QuerySt ring("MyAnswer" )
        >
        George
        >
        No first of all you got GET and POST round the wrong way. GET will include
        the field values in the querystring so you need Request.QuerySt ring where as
        POST puts them in the entity body so you need Request.Form to access them

        Secondly this only applies to receiving values from a form submission. To
        include initial or current values in a response you need to place them
        inline in your response output:-

        <INPUT TYPE="hidden" NAME="MyAnswer"
        VALUE="<%=Serve r.HTMLEncode(My Answer)>%"

        Where MyAnswer is a variable holding the value you want include in the form.


        >
        >
        >
        From
        http://www.developmentnow.com/g/62_2...put-field-.htm
        >
        Posted via DevelopmentNow. com Groups
        http://www.developmentnow.com

        Comment

        • Mike Brind

          #5
          Re: Referencing the value of a input field.

          Nope. These collections are read-only. To set the value, you apply it
          to the Value attribute in the form, either programmaticall y or in the
          html. To read the value, you do as Anthony said.

          Having said that, your use of the term "HTML Control" and VB suggest
          you might be doing stuff with Dotnet. If that's the case, you should
          be posting to a dotnet group. Reading the value will still be more or
          less the same, but setting the value programmaticall y is totally
          different in dotnet to classic ASP.

          If you are indeed dotnetting, try
          microsoft.publi c.dotnet.framew ork.aspnet. If not, and the responses so
          far don't light up your bulb, get back to us.

          --
          Mike Brind

          George Slamowitz wrote:
          Anthony
          >
          Are you saying that to set the value you would as
          >
          "GET" - Request.Form("M yAnswer") = 1 or
          "POST" - Request.QuerySt ring("MyAnswer" ) = 1
          >
          and freference the valuue as
          >
          "GET" - Answer = Request.Form("M yAnswer") or
          "POST" - Answer = Request.QuerySt ring("MyAnswer" )
          >
          George
          >
          >
          >
          >
          From http://www.developmentnow.com/g/62_2...put-field-.htm
          >
          Posted via DevelopmentNow. com Groups
          http://www.developmentnow.com

          Comment

          • George Slamowitz

            #6
            RE: Referencing the value of a input field.

            Mike: I'm not using .NET ... I'm using ASP/HTML

            Anthony:

            I tried to create the the Input Control in the body of the document and in an OnClick routine (VB) I have been trying to set the value based upon upon the button selected. But I can't seem to get the value to set ... I changed the "hidden" to "input" where I was able to see the control. When I set the value inside of the
            input field all of the other logic I have works like a charm, I am just having a problem setting the field after it is created.

            I also tried to create the control ("INPUT") inside of the onclick routine (VB) and remove it from the body of the HTML document, but it did not seem to create it.

            Could the problem be that I am trying to access the control inside of an onclick condition?????? ?????

            Thanks for all of the help ... this one is really taxing my brain

            George

            From http://www.developmentnow.com/groups...hreadid=827396

            Posted via DevelopmentNow. com Groups
            DevelopmentNow is an award-winning creative software development agency integrating mobile, web, hardware, mixed reality, and emerging technology.

            Comment

            • Anthony Jones

              #7
              Re: Referencing the value of a input field.


              "George Slamowitz" <GSlamowitz@COX .NETwrote in message
              news:b8cc5564-7610-49e4-b7f3-01ee440f372a@de velopmentnow.co m...
              Mike: I'm not using .NET ... I'm using ASP/HTML
              >
              Anthony:
              >
              I tried to create the the Input Control in the body of the document and in
              an OnClick routine (VB) I have been trying to set the value based upon upon
              the button selected. But I can't seem to get the value to set ... I changed
              the "hidden" to "input" where I was able to see the control. When I set the
              value inside of the
              input field all of the other logic I have works like a charm, I am just
              having a problem setting the field after it is created.
              >
              I also tried to create the control ("INPUT") inside of the onclick routine
              (VB) and remove it from the body of the HTML document, but it did not seem
              to create it.
              >
              Could the problem be that I am trying to access the control inside of an
              onclick condition?????? ?????
              >
              We are going to need to see some example code of what you have tried. I
              can't make out whether you doing something wrong client side or have
              completely missunderstood how server side code works.
              Thanks for all of the help ... this one is really taxing my brain
              >
              George
              >
              From
              http://www.developmentnow.com/groups...hreadid=827396
              >
              Posted via DevelopmentNow. com Groups
              http://www.developmentnow.com

              Comment

              Working...