Related Item on Edit Form
Good Afternoon,
I have a related items control on a edit form and am experiencing the following issue: -
The list the related item Points to is called "Invoices List", we have used SP Forms to replace the standard forms for this list and as we do not require a Display Form to ever be viewed we have added a HTML divert on to Display Form as follows
With CDATA set to false.
We have used this in a lot of places across our site and it works successfully, however all previous places have been on Display Forms. On this Edit Form we are having an issue where if we open an item directly from the Invoices List the redirect works fine. However if we try to open that same item from the Related Item Control on the Edit Form we just get a small blank rectangle as if no form exists (see attachment). This occurs if we click on the Item Title or if we click the ellipsis and click View Item, if however we click the ellipsis and click Edit Item we are then taken to the Edit Form ( fd_Item_EditForm.aspx ). If I check in the console I get the following errors. I have tried removing and re-adding the Related Item Control, and I have used SP Forms to Reset the Invoice List Display Form and then re-added the redirect HTML script but nothing seems to work.
Any help very much appreciated.
I have a related items control on a edit form and am experiencing the following issue: -
The list the related item Points to is called "Invoices List", we have used SP Forms to replace the standard forms for this list and as we do not require a Display Form to ever be viewed we have added a HTML divert on to Display Form as follows
Code: Select all
<script type="text/javascript">
fd.openForm('fd_Item_EditForm.aspx');
</script>
We have used this in a lot of places across our site and it works successfully, however all previous places have been on Display Forms. On this Edit Form we are having an issue where if we open an item directly from the Invoices List the redirect works fine. However if we try to open that same item from the Related Item Control on the Edit Form we just get a small blank rectangle as if no form exists (see attachment). This occurs if we click on the Item Title or if we click the ellipsis and click View Item, if however we click the ellipsis and click Edit Item we are then taken to the Edit Form ( fd_Item_EditForm.aspx ). If I check in the console I get the following errors. I have tried removing and re-adding the Related Item Control, and I have used SP Forms to Reset the Invoice List Display Form and then re-added the redirect HTML script but nothing seems to work.
Any help very much appreciated.
A second issue we have on the same Edit Form with the Related Item pointing to the Invoices List is with the New Item function. As stated above previously we have really only used Related Item controls on Display Forms and on creation of a New Item following click of the save button on the New Item form the dialogue box closes and the top display form refreshes. However on the edit form it seems that the top edit form actually saves then refreshes, I can see why this would occur to prevent any loss of data previously entered. However we have on load functionality that sets a number of fields to Read Only using JavaScript with OnSubmit functionality to set Read Only to false prior to saving. The reason we are doing this is to prevent user input into these fields as calculations are done by javascript depending on input into other fields.
So the issue here is that when a New Item is added using the related item control and the edit form saves and refreshes the fields that were set to Read Only have been saved as blank entries to the list so on refresh all these fields are now blank.
So the question here is can we intercept the callback function of the New Item click of the Related Item Control to add in the ability to set required fields to Read Only false prior to the save and refresh?
Thanks
So the issue here is that when a New Item is added using the related item control and the edit form saves and refreshes the fields that were set to Read Only have been saved as blank entries to the list so on refresh all these fields are now blank.
So the question here is can we intercept the callback function of the New Item click of the Related Item Control to add in the ability to set required fields to Read Only false prior to the save and refresh?
Thanks
I have done a little more digging on the first issue listed above and believe this issue is occurring because the top form (The Edit Form) where the Related Item resides also has a HTML redirect applied as there is the following HTML script added to the initial Display form to redirect to the edit form if the Status Field = Accepted - With Operations.
What this seems to do is add a huge amount of information into the URL, starting with FDSource, this seems to be the issue, is there a way around this?
Code: Select all
<script type="text/javascript">
<xsl:if test="@Status='Accepted - With Operations'">
fd.openForm('fd_Item_03f2fd90-1516-4306-8061-99ab55d57542_EditForm.aspx');
</xsl:if>
</script>
I believe I have now fixed the first issue of the redirect and not opening the Related item, I found the following forum post viewtopic.php?f=1&t=1034&hilit=fd.openform&start=10 and added the , {Source: ''}); to my redirect and it now seems to be working correctly so I am guessing the issue was that the URL was just too long...
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Tony,
Sorry for the delay! We've tried different methods, but the one that I found working is to write an fd.onsubmit() block to Child element, which reach window.top and set Readonly field to editable state on submit of the Child New Form, like this:
The issue is caused by the fact that the form submits, and this causes the refresh of the Parent form. If the Child form sets Readonly field to editable state, it prevents data loss.
Please, try it and tell me the results, looking forward to it!
Sorry for the delay! We've tried different methods, but the one that I found working is to write an fd.onsubmit() block to Child element, which reach window.top and set Readonly field to editable state on submit of the Child New Form, like this:
Code: Select all
fd.onsubmit(function(){
window.top.fd.field('Field').readonly(false);
return true;
});
Please, try it and tell me the results, looking forward to it!
Cheers
Hi Nikita,
I will try this as may be useful further down the line, I actually got around this by simply moving the fields into a hidden table and then creating HTML fields that display what is in those fields on load and when the calculations are done are updated in line with those fields, this is actually a better solution for us anyway as they now look like proper read only fields and I can append £ and % where appropriate, so from a UX point of view it is obvious which are editable fields...
Thanks again, I will let you know...
I will try this as may be useful further down the line, I actually got around this by simply moving the fields into a hidden table and then creating HTML fields that display what is in those fields on load and when the calculations are done are updated in line with those fields, this is actually a better solution for us anyway as they now look like proper read only fields and I can append £ and % where appropriate, so from a UX point of view it is obvious which are editable fields...
Thanks again, I will let you know...
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests