question

AsherA-5663 avatar image
0 Votes"
AsherA-5663 asked RaytheonXie-MSFT commented

Sharepoint Form Save Button Code

Hi

I want to change the code behind the Save button on Sharepoint online. Can I only change it using sharepoint designer? The admin has not give rights to open the code in sharepoint designer.

If i try to edit the form online , the Save and Cancel buttons are always greyed out .

Thanks

office-sharepoint-server-administrationsharepoint-devoffice-sharepoint-server-developmentoffice-sharepoint-server-customization
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AsherA-5663 ,
Could you please share us where is the save button you want to change?

0 Votes 0 ·

It is the save and cancel buttons by default on form.

Thanks

0 Votes 0 ·
RaytheonXie-MSFT avatar image
1 Vote"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @AsherA-5663 ,
SharePoint Online modern page doesn't support script editor. So we can return to classic experience or use spfx to add custom script.
If you want to use classic experience. You can just follow the steps
Click list setting >> advanced setting
184238-image.png
184279-image.png
184351-image.png
Then you can add a Script Editor by click Edit Page >> add a web part
184298-image.png
184300-image.png
Finally post your code to the webpart
184329-image.png

If you are using modern page. The only way is to use spfx to insert js and css code. You can refer to following document.
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-framework-overview
https://www.sharepointdiary.com/2020/11/add-custom-css-to-sharepoint-online-modern-page.html
And you can also deploy a Script Editor to sharepoint modern page by following example
https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-script-editor



If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





image.png (97.4 KiB)
image.png (49.7 KiB)
image.png (29.0 KiB)
image.png (28.7 KiB)
image.png (101.6 KiB)
image.png (5.0 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am not getting the media and content option at all and many other features after I do these steps.

I read that if i open that form in Sharepoint designer i can see the code behind the save and cancel but i am not able to open the form . It says disallowed to open in designer.


Thanks

0 Votes 0 ·

Hi @AsherA-5663 ,
SharePoint will set DenyAddAndCustomizePages disabled as default. So if you account is a tenant administrator account. You can enable this feature by following steps.
Get to following link https://xxx-admin.sharepoint.com/_layouts/15/online/TenantSettings.aspx
Allow users to run custom script on personal sites
Allow users to run custom script on self-service created sites
It should looks like below:
184929-image.png
Note: This may take up to 24 hours to reflect the changes. Sometimes it may take more than that and sometimes it may take 3/4 hours also.

You can also use following script to set. It won't take 24 hours to enable it.

 $username="xxx@xxx.onmicrosoft.com"
 $userCredential = Get-Credential -UserName $username -Message "Your password"
 Connect-SPOService -Url https://tsinfo-admin.sharepoint.com -Credential $userCredential
 Set-SPOsite https://tsinfo.sharepoint.com -DenyAddAndCustomizePages 0




0 Votes 0 ·
image.png (64.0 KiB)

Hi @AsherA-5663 ,
Have you tried the solution I proposed?

If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·

Hi @AsherA-5663 ,
Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Raytheon Xie

0 Votes 0 ·
AsherA-5663 avatar image
0 Votes"
AsherA-5663 answered

Hello

I am sorry about the delay . I am trying to see the code behind the Save and Cancel buttons .

Somehow the sharepoint designer rights have been blocked .

I read the code behind those buttons could only be viewed through the designer.


Thanks

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AsherA-5663 avatar image
0 Votes"
AsherA-5663 answered RaytheonXie-MSFT commented

I am trying to move list from one site to anothef subsite .

Do these this come under configuration or Administration ?

If i search for a book or a course what should I find it as ?



Thanks

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AsherA-5663 ,
You can follow the steps to migrate list from one site to another site.
https://www.manageengine.com/sharepoint-management-reporting/kb/how-to-migrate-list-from-one-site-collection-to-another.html

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

0 Votes 0 ·

Hi @AsherA-5663 ,
Have you tried the solution I proposed?

If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·