Hi,
Inside the <%loop category_loop%> (in the form.html include template) I want to be able to set the <select> box's 'selected' attribute to a particular category when the form is first loaded. To do so I added this code
<%if page_id ne 'modify' and Full_Name == 'USA'%>selected="selected" <%endif%>
In this case, I wanted the default category to be 'USA'. The full code can be found here:
<%loop category_loop%>
<% if CatDepth == 2%>
<option
<%if page_id ne 'modify' and Full_Name == 'USA'%>selected="selected" <%endif%> style="background-color: #ededed;" value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%elseif CatDepth == 3%>
<option style="color: green;" value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%else%>
<option value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%endif%>
<%endloop%>
The problem:
I am now getting weird results - the default category is not 'USA' - it falls to some other category name for reasons I can't understand...?
Any ideas what I am doing wrong?
Inside the <%loop category_loop%> (in the form.html include template) I want to be able to set the <select> box's 'selected' attribute to a particular category when the form is first loaded. To do so I added this code
<%if page_id ne 'modify' and Full_Name == 'USA'%>selected="selected" <%endif%>
In this case, I wanted the default category to be 'USA'. The full code can be found here:
<%loop category_loop%>
<% if CatDepth == 2%>
<option
<%if page_id ne 'modify' and Full_Name == 'USA'%>selected="selected" <%endif%> style="background-color: #ededed;" value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%elseif CatDepth == 3%>
<option style="color: green;" value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%else%>
<option value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%endif%>
<%endloop%>
The problem:
I am now getting weird results - the default category is not 'USA' - it falls to some other category name for reasons I can't understand...?
Any ideas what I am doing wrong?