Documentation Center

Conditional

A conditional statement. The element must have at least one <When> child element, which may be followed by any number of other <When> child elements, and may then be followed by an <Otherwise> child element.

LanguageCommand
ASP.NET Server Control<ugc:Choose runat="server">
JSP Custom Tag<ugc:Choose>
TCDL tag<tcdl:Choose>

Example

<ugc:Choose>
	<ugc:When test="ugcUser equals ugcComment.User.Id">
		<!-- If the user is the comment author, show a form to edit the comment -->
		<form method="post" id="editCommentForm">
			<input type="hidden" name="commentIdtcm:1-67-64" value="${ugcComment.id}"/>
			<textarea rows="4" cols="30" name="editCommenttcm:1-67-64">${ugcComment.content}</textarea><br/>
			<input type="submit" value="Save comment"/>
		</form>
	</ugc:When>
	<ugc:Otherwise> 
		<!-- If this visitor did not submit this comment, simply display it. -->
		${ugcComment.content}
	</ugc:Otherwise> 
</ugc:Choose>