Update form field from vbscript sub

Discussion in 'ASP General' started by Michael McGrew, Dec 15, 2006.

  1. I have a asp form that has a dynamic drop-down box that a user selects
    a value from. Once the user makes a selection I use the onChange event
    to capture the selection and pass this value to a vbscript sub. The sub
    then makes a adsi query using this value to retrieve additional
    information. This all works. I used a msgbox to display the retrieved
    value and it is correct. My problem is how do I update a field on the
    form with this retrieved value?
    Michael McGrew, Dec 15, 2006
    #1
    1. Advertising

  2. Michael McGrew wrote:
    > I have a asp form that has a dynamic drop-down box that a user selects
    > a value from. Once the user makes a selection I use the onChange event
    > to capture the selection and pass this value to a vbscript sub. The
    > sub then makes a adsi query using this value to retrieve additional
    > information. This all works. I used a msgbox to display the retrieved
    > value and it is correct. My problem is how do I update a field on the
    > form with this retrieved value?


    This isn't really an asp issue, is it. You would be asking the same
    question if your page had a .htm extension. Client-side scripting
    questions should be posted to one of the .scripting groups: in this case
    microsoft.public.scripting.vbscript. Of course, you will have to deal
    with the replies ridiculing your use of vbscript in client-side code
    (because it restricts your users to IE), but once you get past that, you
    should get some help.

    Having said that, you need to use the document.GetElementById method
    toget a reference to the "field" and then set its value property to the
    data retrieved from adsi.


    sub GetADSIValue()
    dim valuefromadsi
    'get the value from adsi and assign it to the variable; then:
    dim obj
    set obj=document.GetElementById("id_of_field")
    obj.value= valuefromadsi
    end sub

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Dec 15, 2006
    #2
    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. Ben
    Replies:
    2
    Views:
    882
  2. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,019
    Lawrence D'Oliveiro
    May 20, 2011
  3. NotGiven
    Replies:
    3
    Views:
    344
    Michael D. Kersey
    May 13, 2004
  4. GavMc
    Replies:
    4
    Views:
    324
    Evertjan.
    Sep 22, 2005
  5. NotGiven
    Replies:
    6
    Views:
    137
    oeyvind toft
    Sep 5, 2004
Loading...

Share This Page