Hi,
Please forgive me as I imagine this is straight forward for a lot of people, but I'm not from a technical background!
We have recently started using Plumsail Forms as an alternative to Forms Designer following some errors and issues.
In Forms Designer I had some code for OnClick in order to make a specified form open when clicking a button from a display form. The code was as follows -
fd.openForm('fd_Item_3c46188a-e58d-4fce-b8fa-68af66aad169_EditForm.aspx')
This doesn't work in Plumsail Forms. We tried using the following to start with but I'm not sure what comes next -
fd.control('Button2').onclick
I can get the first part to work (for example, on click I can get a notification to pop up) but I cannot get it to open a specific edit form from a different form set.
Please can anyone advise how I do this?
Thank you
Ashleigh
Hello Ashleigh,
Welcome to Plumsail Community!
Yes, openForm() function is not available in Plumsail Forms. Instead, you can use a simple redirection on a button click. Please paste this code in the OnClick setting of the button to open the appropriate form set:
//replace "https://domain.sharepoint.com/sites/sitename/subsite" with path to your site
var sitePath = 'https://domain.sharepoint.com/sites/sitename/subsite';
var listName = fd.listUrl.split('/')[2];
var itemId = fd.itemId;
//specify the form set ID
var formSetId = 'c46596f4-3325-43d5-86f9-77fc72d52ad4';
window.location.href = sitePath + '/SitePages/PlumsailForms/' + listName + '/Item/' + formSetId + '/EditForm.aspx?item=' + itemId;
Hello,
That's fantastic, thank you so much! That worked!
Ashleigh
1 Like
Hi. Have something changed inside Forms that causes this Button-click logic to stop working?
I try to use it but end ut in an "invalid URL" message.
From what I can see you build a URL in this structure: /Site Pages/PlumsailForms//Item//*.aspx
This does not seem to match what Forms is creating in my site.
Here I have the structure: /Site Pages/PlumsailForms///*.aspx
There does not seem to be subdirectories created pr subformId.
Please instruct what need to be done to use button to route to a given seubset form.
Thanks
Hello @geirmat,
Do you have only once content type in the list?
Can you open a form set and share its url so I could suggest the solution.