Show a field twice in a form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
haasha
Posts: 4
Joined: Sun Apr 17, 2016

18 Apr 2016

We would like a field appears twice in a form, in a header and also in a tab.
Is that possible?

i.e.

Num:
Customer:
Status:

TAB Detail
Description
Source
Type
...

TAB Customer details
Customer (same field than header):
Address:
...

Sonoma
Posts: 88
Joined: Wed Oct 15, 2014

18 Apr 2016

You could try something like this.

Create a div and append to it. I needed to seperate a checkbox over 3 table rows. Each row and column had to represent different fields but the Main column was the left column. It was the type. I set my table up as normal.
Then created a div for the left column for each result I had in my multiple choice check box.

<tr><td><div id="EGRF"></div>
<tr><td><div id="ALK"></div>
<tr><td><div id="KRAS"></div>


Looks like this in the html:
<table class="fd_table " style="width: 100%;"><tbody><tr><td class="my-table" style="padding: 5px; width: 25%;">

<b>Biomarker</b>
</td><td class="my-table" style="padding: 5px; width: 25%;">

<b>Undocumented</b>
</td><td class="my-table" style="padding: 5px; width: 25%;">

<b>Date of Test</b><br>(MM/DD/YYYY)
</td><td class="my-table" style="padding: 5px; width: 25%;">

<b>Test Result</b>
</td></tr><tr><td class="my-table" style="padding: 5px; width: 25%;">

<div id="EGRF"><span title="EGRF" class="ms-RadioText"><input...BiomarkerField_ctl00_ctl00">EGRF</label></span></div>
... //omitted
<div id="ALK"><span title="ALK" class="ms-RadioText"><input
... //omitted
<div id="KRAS"><span title="KRAS" class="ms-RadioText"><input
... //omitted
for="ctl00_ctl34_g_43184330_c5a8_4a08_9b5d_5735b26eca9f_KRAS2ResultField_ctl00_ctl02">Undocumented</label></span></td></tr></tbody></table></span></div></div></td></tr></tbody></table>


The code behind:

var Biomarker_options = fd.field('Biomarker').control()._el().find('td'); //Find the field if listbox/multi choice
$(Biomarker_options.eq(0).html()).appendTo('#EGRF'); // Append the field to your div. This is my example. You would put your field here.
$(Biomarker_options.eq(1).html()).appendTo('#ALK');
$(Biomarker_options.eq(2).html()).appendTo('#KRAS');
$('.Biomarker-field').hide(); //In my case I hid the original field. But if unhidden I would have twice the field, one together and one seperated.

I have over 200 forms. The user want them to look like the word document and use the logic and flow. I have to get creative. This may be more or less what you needed but I thought I would share it.

Good luck.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

18 Apr 2016

Would that be for a display form or for an edit/new item form?

Sonoma
Posts: 88
Joined: Wed Oct 15, 2014

18 Apr 2016

I use it in both. That is if it is not the main ID. that is tricky in the NEW form since it does not exist until you save.



But you may need to do it a little different in the display form depending on how your out come is. You may get undefined. Tha just means SP displays the field with a diffenert name. I typically on use jquery in the display form for label minuplation or anything that does not require field data.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

19 Apr 2016

Anyway, to the OP. If you want this for the display form you can simply insert a text or a rich text control and add a field name in square brackets to it, e.g.

[Title] - this will display the contents of Title.


Sonoma
Posts: 88
Joined: Wed Oct 15, 2014

19 Apr 2016

That is the other way. It slipped my mind for the moment. Thanks.

Sonoma
Posts: 88
Joined: Wed Oct 15, 2014

28 Apr 2016

I ran into a problem with my solution. Maybe someone can enlighten me. It is probably something simple.
It works great for selecting an option but unselecting does not work so well.
Any ideas how I can unselect a selected DIV?

Thanks.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

28 Apr 2016

How are you selecting the div?

Sonoma
Posts: 88
Joined: Wed Oct 15, 2014

02 May 2016

Since I hide the control I use the cloned controls.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests