1

I have 3 buttons on spfx web part 'Display','Edit' and 'New'.
When I click on these buttons, respective form should open with text boxes and data from sharepoint (online) list.
I want to use Reactjs with VS Code.
How can I implement this requirement?

  • If I understand you correctly you wish to implement SharePoint CRUD (Create Read Update Delete) using react js in Visual Studio Code. Is it so? – mohd tahir Apr 20 '18 at 8:49
  • yes, with document library – raju Apr 23 '18 at 6:21
1

You simply add the link to the list forms in the buttons. For example the new form

<PrimaryButton href="/serverelativeURL/Lists/LISTNAME/NewForm.aspx" >New</PrimaryButton>

It should open the form. If you want to redirect after that, add the ?Source parameter:

/serverelativeURL/Lists/LISTNAME/NewForm.aspx?Source=/serverrelativeURL/yourspfxwebpartpage

  • I tried below code, but throwing 404 error. <PrimaryButton href="/serverelativeURL/Lists/LISTNAME/NewForm.aspx" >New</PrimaryButton> – raju Apr 23 '18 at 6:21
  • You have to add your server relative ulr and your list name... – Oskar Apr 23 '18 at 6:43
  • I used proper URLS, list names, DispForm/EditForm is working, but NewForm.aspx throwing 404 – raju Apr 23 '18 at 9:40
  • Go to your list and open create a new item. Check the url in the browser and use it ;-) – Oskar Apr 23 '18 at 9:59
  • Thanks Oskar, how do I get 'yourspfxwebpartpage'? The form is opening in sharepoint online – raju Apr 24 '18 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.