locked
Custom field inside custom form RRS feed

  • Question

  • I have created a custom field type, which does some things required from my customer. This custom field, is extending SPFieldText. It has a textbox and a button.
    I also have a list using this custom field as a column. For this list, i have a custom form created from SharePoint designer. I imported this field using SharePoint designer (as SharePoint:Formfield) and i can see my custom field working inside the form (the button there opens a splash screen, the user sees the items of a second list in tree view, selects the items he wants and presing ok the textbox of my original page gets the selected items seperated with ";").

    Committing data from the form does not throw any error but the data of this column are not actually saved in the list's item :-( .
    Any one used custom field types with sharepoint designer's custom forms?

    P.S.
    My custom field is working well on the default form (EditForm.aspx) so i think the problem resides on the binding. So i tried to use instead of SharePoint ListFormField, to register the dll i am creating and use it with the following code. This did not work eather as i was getting error that the tag Treenode:TreeViewField is not permited.Any ideas?

    <%@ Register tagprefix="Treenode" Namespace="TreeViewField" Assembly="TreeViewField, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c7e540e6764d7315" %>

    ....
        <Treenode:TreeViewField runat="server" id="wsx{$Pos}" controlmode="Edit" fieldname="test2" __designer:bind="{ddwrt:DataBind('u',concat('ff622',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@test2')}" />
    a.rongas
    Friday, May 29, 2009 2:35 PM

Answers

  • Thank you Edin for your post. Actually it does have all the methods. I have made a fair good number of custom fields but i never had to use them in custom forms. So my first question is, can this be done as simple as that? For me, after tones of work, i think that this cannot be done directly, but it could happen indirectly, which is what i finally did, so i would like to share with the community.

    (In general though, i cannot understand how this binding works when working with custom forms. I think there is the problem, do we have any documentation on ddwrt?)

    In any case, my work around, is fairly simple. Instead of working with a custom field type, i created a similar web  part which i added to a page. The web part, reads anything necessary (i.e. for me the ID of the list item) from the URL. In the form, i add a non editable textbox (since my final data are single line of text...) and a button! The button redirects to the page where the web part is, providing to the URL as queries, the appropriate extra information needed.
    The web part does all the work in needs to do, stores the data to the column of this item edited, and then on submit button, it redirects back to the form... ;-).

    In any case, i ll leave this question open for some time, in case someone else has done the job directly, cause i am curious to find the way/reason.

    a.rongas
    • Marked as answer by a.rongas Saturday, June 20, 2009 12:17 PM
    Wednesday, June 3, 2009 6:52 AM

All replies

  • There's a concise article about how to create custom fields and custom field controls in SharePoint, published in the May issue of MSDN Magazine. It's available here: http://msdn.microsoft.com/en-us/magazine/dd727508.aspx

    Please check that your custom field has all the necessary methods overriden.

    Also, it would help if you could post the source code of your custom field and how do you registered it in SharePoint.

    -- Edin http://edinkapic.blogspot.com
    Tuesday, June 2, 2009 8:22 PM
  • Thank you Edin for your post. Actually it does have all the methods. I have made a fair good number of custom fields but i never had to use them in custom forms. So my first question is, can this be done as simple as that? For me, after tones of work, i think that this cannot be done directly, but it could happen indirectly, which is what i finally did, so i would like to share with the community.

    (In general though, i cannot understand how this binding works when working with custom forms. I think there is the problem, do we have any documentation on ddwrt?)

    In any case, my work around, is fairly simple. Instead of working with a custom field type, i created a similar web  part which i added to a page. The web part, reads anything necessary (i.e. for me the ID of the list item) from the URL. In the form, i add a non editable textbox (since my final data are single line of text...) and a button! The button redirects to the page where the web part is, providing to the URL as queries, the appropriate extra information needed.
    The web part does all the work in needs to do, stores the data to the column of this item edited, and then on submit button, it redirects back to the form... ;-).

    In any case, i ll leave this question open for some time, in case someone else has done the job directly, cause i am curious to find the way/reason.

    a.rongas
    • Marked as answer by a.rongas Saturday, June 20, 2009 12:17 PM
    Wednesday, June 3, 2009 6:52 AM