none
Customize new/edit forms RRS feed

  • Question

  • Hi

    I need to modify the new and edit form for a list as I need to put some validation for the fields that are displayed. I see that these forms use the ListFormWebpart which renders based on the content type control template. ListForm is one such template defined in DefaultTemplates.ascx file. And I saw that list item fields are displayed using ListFieldIterator control. Can I override ListFieldIterator so that I can add my validations?

    Also we wouldn't want to use sharepoint designer as we need to create this as a template and use it across several sites. So we are creating a custom list as a feature and trying to override the default ListForms.

    Typical validation we require are like 

    --disable certain controls when a certain value is selected in dropdown,

    -- Fire selected index changed event on dropdowns to refresh data in other dropdowns etc.

    One approach we thought of was to remove the default ListFormWebpart in new/edit forms and create our custom webpart to handle all the above. But that would mean we need to write lot of code to render controls, save data, security,  uploading attachments etc.

    Hence we thought if we could find a way to work around with the ListFieldIterator which renders the list item fields and then apply the validations we want, it would be better than re-writing everything.

    Any suggestions/code samples to do this will be appreciated


    Thanks
    Tuesday, October 28, 2008 7:09 PM