Search code examples
sharepointhidden

How to predefine and hide a column in SharePoint NewForm and EditForm?


does anyone know how to predefine a column and hide it in SharePoint? I want to create a second NewForm for an already existing List. A new column with two options will make sure to differentiate the two entries in reports/views.

Example:

I have a list with two columns: Name (text) and Type (choice). I want to make two custom NewForms. Both will only have one editable field and both will have one hidden predefined field.

NewForm number 1 will have the Name column visible and Type selected as Male and hidden.

NewForm number 2 will have the Name column visible and Type selected as Female and hidden.

Is this possible?

Regards, David


Solution

  • This is how I implemented this :)

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
    $(function() {
    $('select[title=ColumnName]').val('ValueYouWant');
    $("nobr:contains('ColumnName')").parent('h3').parent('td').parent('tr').hide();
    });
    </script>