Referring to Dynamic form elements 
Author Message
 Referring to Dynamic form elements

Hi,

    Bit of a problem here, hopefully someone can help me as I'm stuck.

    I have an asp page that depending on parameters creates a number of sets
of fields.  I.e. Service1, Name1, ..., Service3, Name3...

    I've created an OnClick event handler for each button related to each
set of fields, and this can happily pass the index value to my general
subroutine that does the processing.

    The thing is, how do you reference a form element like that in code?
    I've tried:

    N="Name" & Index
    Document.Form.N.Value="Tester", but it doesn't like that.

    Any ideas? Though I suppose I could just have asp write all the Add
button code for each set as the page is processed......

    I really want to avoid
Thanks
Luke



Tue, 18 Feb 2003 22:23:03 GMT  
 Referring to Dynamic form elements
I'm not really sure I understand the question, but it appears you want
something like:

N = "Name" & Index
Set Thing = Document.All.Item(N)
Thing.Value = "Tester"

LFS

Quote:

> Hi,

>     Bit of a problem here, hopefully someone can help me as I'm stuck.

>     I have an asp page that depending on parameters creates a number of sets
> of fields.  I.e. Service1, Name1, ..., Service3, Name3...

>     I've created an OnClick event handler for each button related to each
> set of fields, and this can happily pass the index value to my general
> subroutine that does the processing.

>     The thing is, how do you reference a form element like that in code?
>     I've tried:

>     N="Name" & Index
>     Document.Form.N.Value="Tester", but it doesn't like that.

>     Any ideas? Though I suppose I could just have asp write all the Add
> button code for each set as the page is processed......

>     I really want to avoid
> Thanks
> Luke



Wed, 19 Feb 2003 23:04:35 GMT  
 Referring to Dynamic form elements
N="Name" & Index
Document.YourFormNameHere.Elements(N).Value="Tester"

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> Hi,

>     Bit of a problem here, hopefully someone can help me as I'm stuck.

>     I have an asp page that depending on parameters creates a number of
sets
> of fields.  I.e. Service1, Name1, ..., Service3, Name3...

>     I've created an OnClick event handler for each button related to each
> set of fields, and this can happily pass the index value to my general
> subroutine that does the processing.

>     The thing is, how do you reference a form element like that in code?
>     I've tried:

>     N="Name" & Index
>     Document.Form.N.Value="Tester", but it doesn't like that.

>     Any ideas? Though I suppose I could just have asp write all the Add
> button code for each set as the page is processed......

>     I really want to avoid
> Thanks
> Luke



Thu, 20 Feb 2003 04:07:54 GMT  
 Referring to Dynamic form elements

Thanks.


Quote:
> N="Name" & Index
> Document.YourFormNameHere.Elements(N).Value="Tester"

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --



> > Hi,

> >     Bit of a problem here, hopefully someone can help me as I'm stuck.

> >     I have an asp page that depending on parameters creates a number of
> sets
> > of fields.  I.e. Service1, Name1, ..., Service3, Name3...

> >     I've created an OnClick event handler for each button related to
each
> > set of fields, and this can happily pass the index value to my general
> > subroutine that does the processing.

> >     The thing is, how do you reference a form element like that in code?
> >     I've tried:

> >     N="Name" & Index
> >     Document.Form.N.Value="Tester", but it doesn't like that.

> >     Any ideas? Though I suppose I could just have asp write all the Add
> > button code for each set as the page is processed......

> >     I really want to avoid
> > Thanks
> > Luke



Sun, 23 Feb 2003 22:09:01 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. how to refer to select form element?

2. Deleting Dynamic Form Elements

3. How to reach a dynamic form element ?

4. Use dynamic references to form elements in VBA

5. Help referring to specific instances of elements

6. Refer to Other Page Frame Elements using VBScript

7. How do I refer to an element of a collection by NAME with a variable

8. Finding # of specific element in forms elements collection

9. dynamic forms inside dynamic tables

10. referencing dynamic elements

11. dynamic control element name

12. Dynamic arrays that don't contain elements yet

 

 
Powered by phpBB® Forum Software