Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharepoint List redirect with new id

I have a list within Sharepoint, using a custom new form I have added a custom list form control ("New item form" for the list) and changed the SaveButton to a standard input HTML button, and added an 'onclick' event that is as follows:

onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={NewFormWizard2.aspx?id=}')}"

This works as in saves the data and redirects to the NewFormWizard2.aspx?id= page.

How do I get the ID of the created item to be passed to the redirected page?

Thus once the form is completed it would redirect to NewFormWizard2.aspx?id=23

like image 228
TheRealQuagmire Avatar asked Nov 05 '22 21:11

TheRealQuagmire


1 Answers

jtherkel was close, but was missing a '}' on the end of the redirect url. I used an extra concat below

<input type="button" value="Submit" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={lists/MyListName/DispForm.aspx?ID=',/dsQueryResponse/Rows/Row/@ID,'}'))}" />
like image 198
Eric Schrader Avatar answered Nov 12 '22 17:11

Eric Schrader