Topic: Dynamic Controls on a Page
Moderator: I'm not sure if this is the right forum... moving is fine w/me...
.Net'er stepping into RoR using Eclipse Indigo IDE, (Worked a bit'o Android)
In my .Net days (day before yesterday) I would often load a page and display by default certain controls depending on an enum value passed into a function Display_Control(byval e as myAppenum).
Each time an action occurs, Display_Control controls which pannels (div)'s and other html controls render/are visable.
So say when a user enters a new record, certain contact data fields are shown, an ajax lookup is performed once the basic contact info is entered to not enter a dup, then when the user chooses the type of contact certain controls are rendered, for example: type of insurance, sale or rental, B2B or customer.
Then at post/submit, I use the .Net findcontrol to loop through to get the current controlname values NV collection, skipping invalid default values based on the ennum, then w/the enum and the NV collection I get my form ID which passes that to an API which will loop & map my NV values to an insert that includes the database & table names; the form ID ensures that only valid fields & values are inserted, any invalid NV's from the page are ignored, can be logged or messaged back to the user if need be. In other words the page/form displays dynamic fields yet the final data insert is fool proof.
Making new forms/pages is easy add any controls to the new page, load the page ID, NV list & database & table names into a table called control. For enterprise I break the API to a webservice to be consumed by multiple web applications.
fields: recid, formID, HTMLFieldName, dbFieldName, dbFieldType, createdate, createby, active
Gosh, that was long, sorry folks, my big Q's are...
Assuming that only certain controls conditionally render, how would Ruby find the rendered html controls?
Followup - And do an insert into certain tables & fields found at run time?