3

I want to create a form to be filled by users and when the form is submitted I will store the input data in a SharePoint list. So far I have been using either default SharePoint list forms or Infopath forms. I'm thinking of replacing this with HTML forms. My plan is like this

  1. Create the view with HTML/CSS (Reason: want to make the view very dynamic using jQuery and Angularjs) like generate user inputs on-demand.
  2. Submit input data to the list using JSOM.

My concern is if I do this I can only do client-side validation for the input. Does SharePoint handle server-side validation even when we use JSOM to update/add new items? Other than this, what other concerns should I have when I do this? Please advise. Thanks.

3

You can do it, using both JSOM and the Rest OData API, but you´ll have to validate the data on the client, Sharepoint will not handle it.

  • Oh I see, that's what I was wondering. So, if I use these approach, the only input validation that takes place is in the client? Isn't that a bad approach in terms of security? I don't understand why CSOM exposes add/edit data functionality but provide no server-side input validation in their ORM for example. Do you recommend say using JSOM with a completely custom form? – swdon Jul 22 '16 at 16:18
  • JSOM indeed is a good way to create forms. Sharepoint 2013 itself uses javascript to generate the lists forms. The lack of server-side validation is something that bothers me for a long time. – Guilherme Jul 22 '16 at 18:34
  • Yeah I agree. I felt that too but I was wondering if my approach was wrong. Actually, I find it really bad to create my own custom form build it's logic client side and redirect the user with client-side code to my custom form instead of default forms each time. But I guess this is the only way to do it if I want to do everything purely in SharePoint like updating 2 lists with one form (which I've heard that SharePoint is not a good platform to implement such solutions). It's bad stuff when client directly access the data store. – swdon Jul 24 '16 at 7:22
1

You can create custom list forms using SharePoint Designer.

  1. Open SPD
  2. Open your Site
  3. Choose your List under Lists and Libraries
  4. Choose List Form from the ribbon
  5. Define the name and type(new/edit/view) of the new form

You should now see your new form at the bottom-right Forms section.

  1. Click on your form to edit it
  2. Click Advanced Mode in ribbon
  3. All the code is in asp.net, but it shouldn't be to complex if you're familiar with html. You will find all your properties inside <table border="0" cellspacing="0" width="100%">
  4. Add your custom javascript after <SharePoint:UIVersionedContent UIVersion="4" runat="server"><ContentTemplate>
  5. Add your custom css inside <SharePoint:StyleBlock runat="server">
  6. Save your new form and set it as default for that type
  • My problem with this approach is that this form is too rigid and hard to customise because it's a bound form. For example, imagine I wanted to submit multiple items in one form. Like with a control for the user to "Add another item". Would it still work? – swdon Jul 22 '16 at 16:15
  • It is possible, but would be complex this way :) You can also create an .aspx page(your form) and open it in a dialog – Gintas K Jul 22 '16 at 19:17
  • Okay, I understand. I upvoted your answer. I can't really accept it as the answer since it's more of an opinion. Thanks for taking time to advise on the matter. – swdon Jul 24 '16 at 7:17
  • @swdon, have you created the custom html form already? if yes, can you pls share the code for good looking form? – prasadwt Oct 25 '18 at 9:30

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.