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   1189 Views

Avatar
jcoby

Community Member, 2 Posts

7 October 2008 at 9:55am

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

Forum Moderator, 474 Posts

7 October 2008 at 10:37am

Edited: 07/10/2008 10:37am

<% 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

Community Member, 2 Posts

8 October 2008 at 4:20am

worked perfectly! thank you!