Posted by Pär

Worked like a charm. Thanks!
One small problem occurred. If I present a field as a text, it works fine, IF the the data is correct. If the database dont have any value on that field, the server crash. This is the same on all fields in the database. If there is av value there everything is working nicely. Tried to remove the tag <span class="required"></span>, without any success.
Posted by Tom

Then try this helper function instead.
<?php function getTextValue( $key, $val ){ return isset($val->attri['value']) ? $val->attri['value'] : ""; } ?>
It takes care of the case that there is no value in the field.