Finally I inserted the following in my template and it seems to work:
<noparse> <if [template::form::get_errors @id@] not nil> <div class="form-error">Error message goes here</div> </if> </noparse>