CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 populate controls in a loop

Print topic Send  topic

Author Message
rbaldwin

Posts: 172
Posted: 05/12/2004, 11:24 AM

I have a series of 20+ form controls that i need to populate via a lookup.

I've named all of the controls such as xxxn where xxx is

so in my asp code i have something like

form.fld1.value = ccdlookup(...)
form.fld2.value = ccdlookup(...)
...
form.fld20.value = ccdlookup(...)

i'm wondering if i can code this in a loop?
as in

for i = 1 to 20
form.fld & i & .value = ccdlookp(...)
next i

and if so how?
View profile  Send private message
DonB
Posted: 05/12/2004, 1:35 PM

No way that I am aware of. Why so many lookups? Sounds like maybe you
should have a different datasource, one that joins those tables and directly
binds the form fields to the "looked up" values.

--
DonB

http://www.gotodon.com/ccbth


"rbaldwin" <rbaldwin@forum.codecharge> wrote in message
news:640a26bd022782@news.codecharge.com...
> I have a series of 20+ form controls that i need to populate via a lookup.
>
> I've named all of the controls such as xxxn where xxx is
>
> so in my asp code i have something like
>
> form.fld1.value = ccdlookup(...)
> form.fld2.value = ccdlookup(...)
> ..
> form.fld20.value = ccdlookup(...)
>
> i'm wondering if i can code this in a loop?
> as in
>
> for i = 1 to 20
> form.fld & i & .value = ccdlookp(...)
> next i
>
> and if so how?
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

rbaldwin

Posts: 172
Posted: 05/13/2004, 6:04 AM

Actually the issue is not that i have so many lookups i was hoping for a generalized approach to form elements as i have in javascript where i'm able to loop my form fields.
as in:

theForm = document.RFP_CADBusAccounts
for (i = 1; i <= 20; i++)
{ theForm.elements["t"+i].value = 0
}
View profile  Send private message
peterr


Posts: 5971
Posted: 05/13/2004, 11:29 AM

Some examples for the form's Before Show event:
 Dim c: Set c = EventCaller.Controls  
 c.InitEnum  
 While Not c.EndOfEnum  
  Print c.NextItem.Name & "<br>"  
 Wend
 Dim Item  
 Dim c: Set c = EventCaller.Controls  
 c.InitEnum  
 While Not c.EndOfEnum  
  Set Item = c.NextItem  
  If TypeName(Item) = "clsControl" Then  
   If Item.ControlType = ccsLabel Then  
    Item.Value = "Test"  
   End If  
  End If  
 Wend
or in an includable page:
Set FormControls = IncludablePage.RecordForm.Controls  
  FormControls.Items(0).Value = "ABC"  
  FormControls.Items(1).Value = "DEF"  
You can also access form fields by name as discussed at http://forums.codecharge.com/posts.php?post_id=44431
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
rbaldwin

Posts: 172
Posted: 05/13/2004, 12:26 PM

Exactly what i was looking for thanks.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.