Hi,
I have taken over a really messy C#.NET website with several lengthy forms.
Each one has multiple possible paths, and I have been asked to ensure that a user enters data in all fields (all are required)
A typical form would have the following (reduced) structure:
1) What vehicle do you drive?
a) Car
b) Motrobike
If a) What make is it?
If b) What is the odometer reading
2) Do you
a) rent or
b) own your own house?
If a) How much do you pay?
If b) How many bedrooms does it have
The format is generally a radio button for the "top level" question, and textbox input for the "secondary level"
So a possible answer for question 1 would be that I have a Motorbike, and have travelled 100km, etc.
Now, is there a way to combine validation controls in order to ensure that if I check the radio button for "Motorbike", I am required to answer the odometer reading, but not the make?
The only way I can see to do this is very very tedious javascript- especially as the forms are up to 10 or 20 questions.
Is there a better way?
// --------------------------------------------------------------------------------
OR....
Is there a way to target a control on a page in a simalar way to flash eg, I have several text controls with IDs in the format "txt1Name", "txt2Name", "txt3Name" - is there a way to target them like so:
for(Int32 i=0; i<=5; i++) {
string s=Page["txt" + i + "Name"].Text;
// do something with s here
}
Later edit - ok, suddenly remembered "eval" from flash 4 and 5; did a google for C# version of eval and got Page.FindControl() which looks very promising.