1

I'm writing a SharePoint app using the JavaScript Object Model. It uses some customized lists--an events list(calendar) and a contacts list with some customized fields that aren't in the default versions of these lists.

I'm trying to figure out if it is possible for my app to modify the default forms for creating new items in these lists, when it creates the lists.

For example, I like how Microsoft's default forms look but would prefer to hide some of the form controls that aren't relevant to my application:

A form for adding a new calendar item.

I don't need the category, all day event, recurrence, requester, supervisor, or approved fields to be user-editable--the program takes care of that--so I'd rather not have them shown.

When I looked in the NewForm.aspx file, I couldn't find the code that created the controls so I'm not even sure what to edit. Secondly since I'm creating the lists via Javascript, I'm going to need to edit the ddisp/edit/new forms in javascript when I create them. i don't even know where to start here.

Is what I'm doing even possible? Or maybe I should be approaching it differently?

1 Answer 1

1

You don't need to use any code to hide your fields in every form.. Just create a new Content Type with the fields you need, attach it to the list (ensure that its the 1st CT / remove the default CT) and that's the metadata that will show up in your NewForm

Make sure you inherit your Content Type from the parent 'Event'

8
  • Ah this sounds like it will do the trick. I'll report back when I've tried it out, likely on Monday. I assume you can make ContentTypes programmatically with JavaScript. As least I hope so, because my app doesn't have the luxury of having a human build that in the web interface or SharePoint designer, etc..
    – Ectropy
    May 31, 2014 at 7:29
  • This was helpful, I've successfully created the new Content Type and made a list from it. Right now the fields I want to have hidden still show up in the New/Edit forms but I think I'm on the right track.
    – Ectropy
    Jun 3, 2014 at 15:18
  • Did you set the content type as the default on that event list? Jun 3, 2014 at 15:23
  • Yes, it's the default one, and it's correctly adding my custom columns (i.e. Requester, Manager, Approved). I'd just like those columns to be not displayed to the user, but still have them exist on the back end. I think that the approach I need to take now is to modify the New/Edit forms.
    – Ectropy
    Jun 3, 2014 at 15:27
  • OK. Sounds like you're on the right track. Good luck Jun 3, 2014 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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