Display Form hide fields
Hello,
Is it possible to only display fields on the display form that have content/value?
I have been playing with something like this but I haven't had any luck.
$.each($('.fd_control'), function () {
if (!$(this).val()) {
$(this).closest('.fd_field').hide()
}
});
Thanks
Is it possible to only display fields on the display form that have content/value?
I have been playing with something like this but I haven't had any luck.
$.each($('.fd_control'), function () {
if (!$(this).val()) {
$(this).closest('.fd_field').hide()
}
});
Thanks
Please use the following function:
Code: Select all
$.each($('.fd_control'), function () {
if
(!(/\S/.test(fd.field($(this).closest('.fd_field').attr('fd_name')).control(
)._el().text()))){
$(this).closest('.fd_field').hide();
}
});
Hi,
This code work great on one of my list. However when I apply it to another list. Everything is hidden, even fields with a value, the display is set to none.
Here is an field that has content but is getting hidden
<td style="padding: 5px; width: 100%;"><div class="fd_field " style="height: 27px; display: none;" fd_name="Copies"><div class="fd_title" style="width: 50px; white-space: nowrap;">Copies</div><div class="ms-formbody fd_control" fd_type="Text" fd_readonly="True">2</div></div></td>
Any idea as to why it is hiding this field?
Thanks
This code work great on one of my list. However when I apply it to another list. Everything is hidden, even fields with a value, the display is set to none.
Here is an field that has content but is getting hidden
<td style="padding: 5px; width: 100%;"><div class="fd_field " style="height: 27px; display: none;" fd_name="Copies"><div class="fd_title" style="width: 50px; white-space: nowrap;">Copies</div><div class="ms-formbody fd_control" fd_type="Text" fd_readonly="True">2</div></div></td>
Any idea as to why it is hiding this field?
Thanks
I copy-pasted in your element and the code works as expected. The " display: none;" part the of the style attribute - is it there before the code is run?
If not, please send us the html of your display page to support@spform.com .
If not, please send us the html of your display page to support@spform.com .
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Thanks, maybe I copied something wrong. It is now working for me.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 18 guests