Quote:
Originally Posted by Old Pedant
Can you give us some *REAL* examples...or at least make up some examples that are readable and understandable???
I'm somewhat mystified why you would need to re-read the XML file instead of just generating the entire code all at once.
|
With the above xml I try to create an html form like this:
Code:
<form>
<input type=text Value="uitleg2" />
<input type=text Value="uitleg1" />
<select name="IfElseActivity1" OnChange="showDiv(this);" />
<option selected=""selected"" value=""> IfElseBranchActivity1</option>
<option selected=""selected"" value=""> IfElseBranchActivity2</option>
</select>
<input type=text Value="uitleg3" />
<input type=text Value="uitleg4" />
</form>
This xml can become very complicated so I need to create a routine which builds the form. What i try to do now is in ASP:
Code:
select case actionType
case "Uitleg"
if previousAction = "IfElseBranchActivity" or (previousDepth - depth = 2) then
if previousDepth > depth then
Response.Write "</select>"
Response.Write "<br/>"
response.write tempAction
Response.Write "<div id='div" & branchId & "' class='c" & branchId & " " & choiceId & "' style=" & visibleId & ">" & actionId & ": <input type=text Size=25 Name=uitleg2 readonly=yes Value="" Dit is de tekst van uitleg21 "" />" & "</div>" & "<br/>"
end if
tempAction = tempAction & "<div id='div" & branchId & "' class='c" & branchId & "' style=" & visibleId & ">" & actionId & ": <input type=text Size=25 Name=uitleg2 readonly=yes Value="" Dit is de tekst van uitleg22 "" />" & "</div>" & "<br/>"
else
%>
<div id="div<%= branchId %>" class="c<%= branchId %>" style="<%= visibleId %>" > <%= actionId %> : <input type=text Size=25 Name=uitleg2 readonly=yes Value="Dit is de tekst van uitleg23" /></div><br/>
<%
end if
case "IfElseActivity"
choiceId = actionId
Response.Write "<select name="& chr(34) & actionId & chr(34) & " OnChange=" & chr(34) & "showDiv(this);" & chr(34) & ">" & vbCrLf
case "IfElseBranchActivity"
branchId = branchId + 1
visibleId = "'display: none;'"
Response.Write "<option selected=""selected"" value=" & chr(34) & branchId & chr(34) & ">" & actionId & "</option>"
case "Optie"
end select
This gets way to complicated.... to make it more complicated some the visibility of some fields depends on the choice the user makes in the select box. But the suggestion from peterpeiguo might do that.
I hope this clears things a bit. Maybe my approach (asp) is wrong