Creating Dynamic Web Sub-Forms

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
justbob3377
Forum Newbie
Posts: 4
Joined: Sat Jul 19, 2008 7:39 am

Creating Dynamic Web Sub-Forms

Post by justbob3377 »

Not sure where to post this?!

In my database model, I have a SuperType (tblExpense) and several related SubTypes (tblFuel, tblElectric, tblTelephone).

On the data entry form I want to build, users will always see "ExpenseID", "ExpenseDate" and "MerchantName" which are in tblExpense. However, depending on the value selected for "Form Category" and "Form SubCategory", users should see different remaining fields. (The logic being that you should see "Total Gallons" when you are entering in your Electric Bill!!)

**Blue fields are always the same, regardless of Expense Type.
** Red fields vary depending on the Expense Type, and are determined by "FormCategory" and "FormSubCategory" the user would select.


For example, if you wanted to enter July's Electric bill, you would see...

ExpenseID
ExpenseDate
MerchantName

BaseServiceCharge
TotalKWH
SupplyRate
TotalSupplyCharge
DeliveryRate
TotalDeliveryCharge

TotalExpense

If you wanted to enter a Gas receipt, you would see...

ExpenseID
ExpenseDate
MerchantName

FuelType
NumberOfGallons
CostPerGallon

TotalExpense

In the MS Access database I am using to "prototype" this system, I will probably use a Tabbed Subform and VBA code to dynamically display/hide different tabs containing the appropriate fields. However, I am unsure of how to do this on a web-form?! ???

So, how can I create a dynamic "sub-form" which will display different fields based on the Expense you want to enter??

I am pretty flexible - for now - on what the solution looks like. It could be...
1.) A single, homogeneous form where only the fields change
2.) A main form that is static with a sub-form that dynamically changes and displays different fields
3.) Something more sophisticated like a Tabbed Subform that hides/unhides different tabs and/or fields as needed.

**I prefer to NOT use Frames!

Is this something that you would do using PHP? HTML? CSS? AJAX?

More so, how would you do it?!



Just Bob
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Creating Dynamic Web Sub-Forms

Post by califdon »

Would you post your table structures? I have some concern about your data normalization.
justbob3377
Forum Newbie
Posts: 4
Joined: Sat Jul 19, 2008 7:39 am

Re: Creating Dynamic Web Sub-Forms

Post by justbob3377 »

califdon wrote:Would you post your table structures? I have some concern about your data normalization.
Well, relevant to this conversation...

(1) Expense ---> (m) ExpenseDetail

(1) Expense (super-type) ---> (m) Expense (sub-types) *As described earlier

Trust me, there are no normalization issues here! :wink:


Just Bob
Post Reply