Removing a column from NewForm.aspx

Posted: October 19, 2008 in Custom Form, Sharepoint Designer

In some cases you may need to hide some of the columns of the newform.aspx from the form. It may be populated by code or you may not needed the user to enter the details for those columns. In this case there is no out-of-box feature provided by MOSS.

So you have to go for Sharepoint Designer.

  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the ‘NewForm.aspx’ web form.
  3. Go File -> Save As… and give the form a new name such as ‘NewForm2.aspx’.
  4. Hide the default List Form Web Part from the page (do not delete it!!) by Right clicking the List Form Web Part -> Web Part Properties -> expand Layout -> check Hidden.
  5. Go Insert > SharePoint Controls -> Custom List Form.
  6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list (in my environment all the controls show “Error Rendering Control” but this does not affect the final result).
  8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
  9. At this point, you can do other customisation such as rearranging the fields if you wish.
  10. Save the site.
Advertisements
Comments
  1. […] creating a Custom Form in designer remove or hide the Ok and Cancel button and place this code […]

  2. KC says:

    That’s great, but the NewForm2.aspx doesn’t show up with the other forms, in Designer. Therefore, how do I tell it to “Set as Default” ??

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s