p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Dynamic ASP Forms


Message #1 by "Matt Besseling" <mattb@h...> on Wed, 26 Jul 2000 13:57:42
I have a form with fields that are dynamically generated for by the number 

of records coming from a POST field. That's not the problem. The form is 

emailed to me. That's also no the problem.



The problem is that because the fields in the form are dynamic, field names 

are NOT assigned to them. Therefore, when I receive the form, it only 

contains the first fields (the ones that contain the dynamic comands).



Basically, does anyone know of a way to dynamically assign field names, ie. 

adding a number onto the back of the Name field (number1, number2, etc.) 

The form itself is already in a DO...WHILE clause, so it's kind of tricky 

to work out.



Any takers?



Thanks

Matt Besseling

Message #2 by Imar Spaanjaars <Imar@c...> on Wed, 26 Jul 2000 15:21:11 +0200
Perhaps you should show the code that generates the form so we know what 

you mean exactly..



In general, it's not that difficult to generate unique names for fields in 

aloop.

Just keep a counter, and add the following code inside the loop:



sHTML = sHTML & "<INPUT TYPE=""text"" NAME=""field" & iLoopCounter & """>" 

& vbCRLF



This will generate the following code in HTML



<INPUT TYPE="text" NAME="field1">

<INPUT TYPE="text" NAME="field2">

etc.



Hope that this is what you are looking for.



Imar





At 01:57 PM 7/26/2000 +0000, you wrote:

>I have a form with fields that are dynamically generated for by the number

>of records coming from a POST field. That's not the problem. The form is

>emailed to me. That's also no the problem.

>

>The problem is that because the fields in the form are dynamic, field names

>are NOT assigned to them. Therefore, when I receive the form, it only

>contains the first fields (the ones that contain the dynamic comands).

>

>Basically, does anyone know of a way to dynamically assign field names, ie.

>adding a number onto the back of the Name field (number1, number2, etc.)

>The form itself is already in a DO...WHILE clause, so it's kind of tricky

>to work out.

>

>Any takers?

>

>Thanks

>Matt Besseling





Message #3 by "Marco Voegeli" <marco.voegeli@m...> on Wed, 26 Jul 2000 15:37:32 +0200
THE FOLLOWING SYNTAX WILL CREATE THE FORM WITH

DYNAMIC FIELDNAMES



rec is the recordset

----------------------

dim i

i=1



do until rec.eof

<%

<form action=xjfsf.asp name=dfsdf>

%>



<input type=text name=number<%=i%>> 'i is the number



</form>

<%

i=i+1

rec.movenext

loop

%>



TO DYNAMICALLY PROCESS THIS FORM YOU CAN USE

THE FOLLOWING SYNTAX:



<%

Dim object, objectname



For each object in Request.Form

%>



Name of field: <%=object%><br>

Value of field: <%=Request.Form(object)%><p><hr>



<%

next

%>



THE LAST CODE ABOVE WILL LIST

THE FIELDS AND ITS VALUES



Best regards

Marco







----- Original Message -----

From: "Matt Besseling" <mattb@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, July 26, 2000 1:57 PM

Subject: [asp_databases] Dynamic ASP Forms





> I have a form with fields that are dynamically generated for by the number

> of records coming from a POST field. That's not the problem. The form is

> emailed to me. That's also no the problem.

>

> The problem is that because the fields in the form are dynamic, field

names

> are NOT assigned to them. Therefore, when I receive the form, it only

> contains the first fields (the ones that contain the dynamic comands).

>

> Basically, does anyone know of a way to dynamically assign field names,

ie.

> adding a number onto the back of the Name field (number1, number2, etc.)

> The form itself is already in a DO...WHILE clause, so it's kind of tricky

> to work out.

>

> Any takers?

>

> Thanks

> Matt Besseling

>

> ---

> Do you know what you want from this list? How would you provide

programmers with the solutions they need? If you have the answers, and are

willing to work in Birmingham (UK), then you could be a List Manager. Please

send CVs and a covering letter to listsupport@p... for further

information.

> ---

> You are currently subscribed to asp_databases


$subst('Email.Unsub')

>



Message #4 by "Marco Voegeli" <marco.voegeli@m...> on Wed, 26 Jul 2000 15:41:10 +0200
Once again me



Sorry for my mistake:



rec is the recordset

----------------------

dim i

i=1



do until rec.eof

<%

<form action=xjfsf.asp name=dfsdf>

%>



<input type=text name=number<%=i%>> 'i is the number



</form>

<%

i=i+1

rec.movenext

loop

%>



Of course do not write the html-form-tag into the loop. Insert it before

and the end-tag after it.



rec is the recordset

----------------------

dim i

i=1%>

<form action=xjfsf.asp name=dfsdf>

<%

do until rec.eof

%>



<input type=text name=number<%=i%>> 'i is the number





<%

i=i+1

rec.movenext

loop

%>

</form>

<%





----- Original Message -----

From: "Matt Besseling" <mattb@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, July 26, 2000 1:57 PM

Subject: [asp_databases] Dynamic ASP Forms





> I have a form with fields that are dynamically generated for by the number

> of records coming from a POST field. That's not the problem. The form is

> emailed to me. That's also no the problem.

>

> The problem is that because the fields in the form are dynamic, field

names

> are NOT assigned to them. Therefore, when I receive the form, it only

> contains the first fields (the ones that contain the dynamic comands).

>

> Basically, does anyone know of a way to dynamically assign field names,

ie.

> adding a number onto the back of the Name field (number1, number2, etc.)

> The form itself is already in a DO...WHILE clause, so it's kind of tricky

> to work out.

>

> Any takers?

>

> Thanks

> Matt Besseling

>

> ---

> Do you know what you want from this list? How would you provide

programmers with the solutions they need? If you have the answers, and are

willing to work in Birmingham (UK), then you could be a List Manager. Please

send CVs and a covering letter to listsupport@p... for further

information.

> ---

> You are currently subscribed to asp_databases


$subst('Email.Unsub')

>



Message #5 by Hari Yellina <hyellina@k...> on Wed, 26 Jul 2000 09:07:40 -0500
Try to put it in array. any way it is in while loop. Then again by the

number you can retrieve

HK Yellina,

Kanbay Software (India) Pvt. Ltd.

A-1, Technology Park,

MIDC,

Talwade,

Pune,

Maharastra.

412114

ph 091-020-7691100 ext-440



> ----------

> From: 	Marco Voegeli[SMTP:marco.voegeli@m...]

> Reply To: 	ASP Databases

> Sent: 	Wednesday, July 26, 2000 8:37 AM

> To: 	ASP Databases

> Subject: 	[asp_databases] Re: Dynamic ASP Forms

> 

> THE FOLLOWING SYNTAX WILL CREATE THE FORM WITH

> DYNAMIC FIELDNAMES

> 

> rec is the recordset

> ----------------------

> dim i

> i=1

> 

> do until rec.eof

> <%

> <form action=xjfsf.asp name=dfsdf>

> %>

> 

> <input type=text name=number<%=i%>> 'i is the number

> 

> </form>

> <%

> i=i+1

> rec.movenext

> loop

> %>

> 

> TO DYNAMICALLY PROCESS THIS FORM YOU CAN USE

> THE FOLLOWING SYNTAX:

> 

> <%

> Dim object, objectname

> 

> For each object in Request.Form

> %>

> 

> Name of field: <%=object%><br>

> Value of field: <%=Request.Form(object)%><p><hr>

> 

> <%

> next

> %>

> 

> THE LAST CODE ABOVE WILL LIST

> THE FIELDS AND ITS VALUES

> 

> Best regards

> Marco

> 

> 

> 

> ----- Original Message -----

> From: "Matt Besseling" <mattb@h...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Wednesday, July 26, 2000 1:57 PM

> Subject: [asp_databases] Dynamic ASP Forms

> 

> 

> > I have a form with fields that are dynamically generated for by the

> number

> > of records coming from a POST field. That's not the problem. The form is

> > emailed to me. That's also no the problem.

> >

> > The problem is that because the fields in the form are dynamic, field

> names

> > are NOT assigned to them. Therefore, when I receive the form, it only

> > contains the first fields (the ones that contain the dynamic comands).

> >

> > Basically, does anyone know of a way to dynamically assign field names,

> ie.

> > adding a number onto the back of the Name field (number1, number2, etc.)

> > The form itself is already in a DO...WHILE clause, so it's kind of

> tricky

> > to work out.

> >

> > Any takers?

> >

> > Thanks

> > Matt Besseling

> >

> > ---

> > Do you know what you want from this list? How would you provide

> programmers with the solutions they need? If you have the answers, and are

> willing to work in Birmingham (UK), then you could be a List Manager.

> Please

> send CVs and a covering letter to listsupport@p... for further

> information.

> > ---

> > You are currently subscribed to asp_databases


> $subst('Email.Unsub')

> >

> 

> 

> ---

> Do you know what you want from this list? How would you provide

> programmers with the solutions they need? If you have the answers, and are

> willing to work in Birmingham (UK), then you could be a List Manager.

> Please send CVs and a covering letter to listsupport@p... for

> further information. 

> ---

> You are currently subscribed to asp_databases 


> $subst('Email.Unsub')

> 


  Return to Index