1

I want to ask the user to complete some columns of a list item and show him only like 5 columns of a list and complete the others programmatically (others that are not visible to the user).

Is this possibly? How do I hide specific columns so the user just sees the ones he needs to see and complete others programmatically? Is there column property to set for this or anything else to do?

3

Go to list settings -> Advanced settings -> Allow management of content type -> check the box

Go back to list settings -> Under content type -> click Item content type -> click the column you want to hide -> Hidden (check the box)

Once you mark the column as Hidden, it will not appear to users on Add/Edit forms (you have to remove it from the view by going to View Settings)

Now you can write an Event Receiver for this list and on ItemAdding event, set the After Properties for these hidden columns. Following gives an example of such an event receiver:

Event Receiver for specific list instance
Event Receivers

| improve this answer | |
  • This will work. And event receivers is what i needed after so thank you for the complete answer :D – user5014677 Nov 3 '15 at 7:50
  • No need of server code, this can be handled with Javascript too. – Taran Goel Nov 3 '15 at 12:36
  • Really I would like to know how, please add it as an answer ! :) – Arsalan Adam Khatri Nov 3 '15 at 12:45
  • 1
    I would not use Event Receiver unless you want to be 100% sure you have to redo all the programming in the future. The CodePlex library SPUtility is one of the options of doing it client side. Or (In 2013) do it all with pure JavaScript using CSR (Client Side Rendering) – Danny '365CSI' Engelman Nov 4 '15 at 9:45
0

You can either choose to create a custom New Item Form for that list and write code CSOM code to update the other fields programatically on the click of SAVE button.
OR
If you just want to hide columns from New Item Form then use content type management for the list.
Go to List Settings -> advanced settings -> Allow Content Type management -> Yes.
Now go again to List Settings -> Under Content Type, Click on Item Content Type.
Now click the columns which you want to hide from forms.

| improve this answer | |
0

There are a couple of ways to do this without any server code:

  1. Make the columns you're interested in having automatically filled in calculated columns
  2. If calculated columns don't work, you can implement this using Javascript

There are really two ways I would consider implementing a JavaScript solution:

  1. Add a PreSaveAction function to the item creation/edit form to override the behavior of the save/submit button.
  2. Create your own HTML forms for creation and editing then using the REST API or JSOM library to handle the submission of user input and

For your scenario, if you decide to use a PreSaveAction function you should probably always return false and completely override the item creation routine with your own JavaScript so you can submit all of the fields (including those you calculate) at the same time -- then just redirect the user back to where they came from (the Source parameter in the URL) after the submission is complete.

Some more information on PreSaveAction can be found in other places on SharePoint SE in posts like this: How to redirect to page from List Form

| improve this answer | |

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.