Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

setting selected attribute for an <option>


Reply

3 Posts   1110 Views

Avatar
jcoby

7 October 2008 at 9:55am Community Member, 2 Posts

I'm trying to build a <select> manually with all of the children of a certain page. The code looks like:

<% control ChildrenOf(case-studies) %>
          <% if ClassName = RedirectorPage %>
<option value="$ContentSource.Link">$Title</option>
<% end_if %>
<% end_control %>

How can I set the selected attribute if the current page is a child of the page being use for the <option>?

Avatar
simon_w

7 October 2008 at 10:37am (Last edited: 7 October 2008 10:37am), Forum Moderator, 474 Posts

<% control ChildrenOf(case-studies) %>
<% if ClassName = RedirectorPage %>
<option value="$ContentSource.Link"<% if LinkOrSection = section %> selected="selected"<% end_if %>>$Title</option>
<% end_if %>
<% end_control %>

Should do it.

Avatar
jcoby

8 October 2008 at 4:20am Community Member, 2 Posts

worked perfectly! thank you!