So here's what I want to do. I want to take a list of phrases, and in certain parts of the phrases, indicate that user input is required.. be it a dropdown list, a textbox, a date field, etc. Kind of like Madlibs in a way.. but with the option of selecting things from a list.
For example:
I own a
?list_of_cars?
, I purchased it on?date?
. It has?freetext?
miles on it.
This string gets broken apart into a mixture of text and HTML form fields/ASP.net controls.
?list_of_cars?
gets turned into a dropdown list with a few options to choose from.
?date?
gets turned into a date field (custom user control I created)
?freetext?
is simply a textbox that the user can enter information into.
I have about 50 of these phrases that I need to work with. The end result is that they will end up being plain text in a textbox after the user fills out the required input.
No lists need a large number of options.. cars was kind of a bad example. The most options a list would contain would be 5 probably.
At this point, I started storing the entire string with a number of delimiters and placeholders into a database table.
For example, one row looks like this:
I own a
{list^Nissan,Ford,Chevy}
, I purchased it on{date}
. It has{text}
miles on it.
Then I break it down and replace the placeholders with form fields.. then put it all back together into pure text. I feel like there might be a smarter/better way to do this. I'm not opposed to backing up and changing how the initial phrases are stored.
Just curious if anyone might have any tips/suggestions?