Posted on 16/12/2013 13:15:08
Hidden fields are handled in a special way by the Data Lists Form module: They are not rendered inside the Form.Fields loop, but are rendered together with other hidden system fields in the @Form.Hidden template tag. The reason for this is that they should not affect the layout of the form, e.g. by rendering empty table rows (when using the default templates).
Right now, the best solution to this challenge is to change the hidden field to regular text fields and modify the form template to make them hidden:
<div>
<!-- Render "visible" fields -->
<!--@LoopStart(Form.Fields)-->
<!--@If Not(Field.Label<contains>_hidden)-->
<!--@Field.Label-->: <!--@Field.Control-->
<!--@EndIf-->
<!--@LoopEnd(Form.Fields)-->
</div>
<!-- Render "hidden" fields -->
<div style="display: none">
<!--@LoopStart(Form.Fields)-->
<!--@If(Field.Label<contains>_hidden)-->
<!--@Field.Control-->
<!--@EndIf-->
<!--@LoopEnd(Form.Fields)-->
</div>
It's not a very good solution, but it works.
Another way to do it, is to use the notifications Notifications.Form.OnBeforeRender and Notifications.Form.OnAfterRender to render the hidden fields, but this requires custom code.
I've created a backlog item for this issue and we'll see if it makes sense to handle hidden fields just like non-hidden field in the form.
Best regards,
Mikkel