default save button

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
NatašaCerin
Posts: 7
Joined: Mon May 01, 2017

10 Apr 2018

Hi,

i have one strange issue. In a form I added additional save buttons with additional functions (change status). The buttons are working without problems, also save and cancel.
The problem is with default Save button in the header of item (SP default). SP default SAVE button runs query defined in custom Save button.
If i change the order of the buttons, and the normal save on form is on the left side (the first one) then also the default save is working normal.

Thank you
Nataša

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

10 Apr 2018

Dear Nataša,
Can you, please, tell us more about the custom buttons? What code do they have and how it runs? Is it running from OnClick property or from inside JS editor? Can you also copy and paste here the code that you have in JS editor that causes this behavior? All this information should help us determine what goes on.
Cheers

User avatar
NatašaCerin
Posts: 7
Joined: Mon May 01, 2017

10 Apr 2018

I used a SAVE button with onClick code = fd.field('Status').value('In progress'). and this is working
Then I have the second Save button with onClick code = fd.field('Status').value(Closed). and this is working
then i have the third SAVE - only save without any action.

Save button on the top of the screen (the original one from SP) runs fd.field('Status').value('In progress')

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

10 Apr 2018

Dear Nataša,
If I understand correctly, there are four buttons total:
1) Button on top - no code OnClick
2) Button on the bottom left - OnClick: fd.field('Status').value('In progress')
3) Button on the bottom center - OnClick: fd.field('Status').value(Closed)
4) Button on the bottom right - no code OnClick

Is that correct? And you have an issue that button #1 executes code from button #2, right? Have you tried to delete button #1 and place a new one instead?
Cheers

User avatar
NatašaCerin
Posts: 7
Joined: Mon May 01, 2017

10 Apr 2018

Hi Nikita,
Yes you are correct. But button #1 is deafult button in the shareoint item mask ( on the top). I also try to delete button #2 and create a new one, but the same issue. At the end I change the order of buttons.
From the left- #4 ( no code), #2 , #3. Now the button #1 works.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

11 Apr 2018

Dear Nataša,
Now I see! So, you mean the Save button in the Ribbon, correct? An easy way to prevent it from running the code, but not to change the button order would be to add 1 more Save button before other buttons in the form.
To prevent it from being visible, set LAYOUT Style:

Code: Select all

display:none;
The Save button in the ribbon simply clicks the closest Save button on the form, that's why it runs the script as well. If you add a new button without the code before other buttons and hide it, when you click Save button in the ribbon, it will click the hidden Save button and will save with no extra code running.
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests