b:validate

<b:validate>...</b:validate>

Validates fields by the given rules and displays possible messages.

With this tag you can display possible validation messages. You can test and display all validation messages with <b:validate> tag. To test validation from a particular form, you can add the form name to the tag. See the example for testing validation.

Validations are tested in the given order. If multiple rules are given for a single field, the validation of that field field will stop when a validation rule is not met. This means that you will get only one validation message for a single field even if the field would fail many rules.

b:validate tags

b:validate

<b:validate/>
Displays a validation message

b:before

<b:before>...</b:before>
Show content before the validation messages

b:data

<b:data>...</b:data>
Shows content with each message

b:after

<b:after>...</b:after>
Show content after the validation messages

Examples

Testing validation and displaying messages

<!--
	this will display all the validation messages that occur on the page
-->
<b:validate>
	<div class="notice"><b:validate/></div>
</b:validate>

<!--
	This will display messages only from the addcomment form.
	b:before and b:after tags are also used to help get a nice clean html.
-->
<b:validate.addcomment>
	<b:before><ul class="notice"></b:before>
	<b:data><li><b:validate/></li></b:data>
	<b:after></ul></b:after>
</b:validate.addcomment>

<!--
	THIS IS NOT IMPLEMENTED YET
	this will test a single field
-->
<b:validate.addcomment.name>
	<div class="notice"><b:validate/></div>
</b:validate.addcomment.name>

<b:form datamodel="comment" name="addcomment">
	<div>
		<h2>If there was a problem with you're name, the message will be
		displayed below</h2>
	<!--
		THIS IS NOT IMPLEMENTED YET
		this will display a possible validation message from the name field.
		b:validation will display the message with a short tag only when
		you refer to a single tag. Otherwise you need to use the block
		tag (like above) to display messages
	-->
		<b:validate.addcomment.name/>
	</div>

	<label>Your name</label><b:addcomment.name/>

	<b:addcomment.comment/>
	<input type="submit" value="post a comment"/>
</b:form>