Jump to content

Creating Dynamic Web Sub-Form


justbob3377

Recommended Posts

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

 

 

 

Link to comment
Share on other sites

If there are only a limited number of primary options the user can select - then you can preload the COMPLETE form, and use javascript to alter the sub forms after the primary choice. If there are A LOT of primary options, use AJAX to fill in the sub forms.

 

You still will need to use php/css/html to create the functioning form.

Link to comment
Share on other sites

Thanks for the reply!

 

If there are A LOT of primary options, use AJAX to fill in the sub forms.

 

You still will need to use php/css/html to create the functioning form.

 

I will likely have 10-15 different forms which will be pretty diverse (e.g. Groceries, Fuel, Electric, Car Insurance, Telephone, Airfare, Medical, etc.).  And they will be diverse enough to where you wouldn't just want to hide/unhide a few fields.

 

They need to be completely different creatures, although to the user, I want the user to feel like they are on just one "Expense Data Entry Form" and the form adjusts to what they are entering.

 

Conceptually, do I want to create just one HTML/CSS page and use code to dynamically alter which fields are displayed.  Or, do I want to do like I think they did in the "old days" and have one "SuperType" main form, and then create, say, 15 "SubType" Sub-Forms and depending on the Expense Type, display the applicable Sub-Form in the Main Form?  (I believe that is how people used Frames in the past, although I hear Frames are evil and I want to avoid them!)

 

Also, what would be creating the different Sub-Forms and/or Fields?

 

Is that something PHP does?

 

AJAX?

 

CSS?

 

 

Pardon the dumb questions, but while I know what I want/need, I really know very little about web design.  (I used to know HTML and CSS, but that was like 4 years ago.  I have never worked with PHP or AJAX, although I want to start!)

 

 

 

Just Bob

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.