CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Dyamically Reference Forms Fields from Database Lookup

Print topic Send  topic

Author Message
cwb

Posts: 5
Posted: 06/26/2006, 10:33 PM

I want to dynamically reference form fields to set their visibility and associated labels based on a database lookup. I have tried every combination that I can think of - but with no joy. The db side is no problem.

Basic logic is get recordset based on 'type' of object in the forms BeforeShow event then loop over the results and set the fields as required (field name, visibility, label name, label value). Basically I want to control the form output via the database...

I'm hoping that this is real easy and as a 'newbe' I've missed something very basic ;-)
View profile  Send private message
peterr


Posts: 5971
Posted: 06/26/2006, 10:52 PM

Maybe this will help: http://forums.codecharge.com/posts.php?post_id=46849
Although I'm not sure what do you mean by setting field name or label name - those are static control identifiers.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
cwb

Posts: 5
Posted: 06/27/2006, 1:26 PM

Peter,

The reference article is close but not quite what I wanted. It allows me to cycle through the controls but I still can't work out how to specify an particular control explicitly - for example:

Dim c, item

Set c = EventContoller.Controls

Now open connection to database and return recordset - then loop through record rows and for each refer to a specific field by its fieldName - i.e

Set item = c.item.<fieldName> {this is the part that I can't get the
syntax right}
item.visible = false

etc

Regards,

Craig
View profile  Send private message
peterr


Posts: 5971
Posted: 06/27/2006, 1:40 PM

Try: FormControls.GetItemByName("abc").Visible = True
or if looping through record rows containing field names in "field_name" column: FormControls.GetItemByName(fields_rs("field_name")).Visible = True
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
cwb

Posts: 5
Posted: 06/27/2006, 1:51 PM

Peter,

Brillant - works exactly as required.

Many thanks,

Craig
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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