Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Edit document webpart form View modes: 
User avatar
Member
Member
Peter - 5/13/2013 1:24:27 AM
   
Edit document webpart form
Hi,

I have a document type with a custom layout for editing. Now I'm trying to setup a webpart which would allow for editing these documents. So far I have tried cms:DataForm and cms:BasicForm with some mixed results.
This webpart is visible only to a special role which wouldnt have an access to cmsdesk.

Have anyone tried to do this or should I just do my own form on the webpart?

Any suggestions?

Thanks, Peter

User avatar
Certified Developer 13
Certified Developer 13
kentico_josefd - 5/13/2013 3:45:51 AM
   
RE:Edit document webpart form
Hello,

Based on your description, I would suggest using the Repeater web part and setting up Editing buttons. This will allow you to edit existing and add new documents of your custom document type. You can see an example of this setup on the sample Corporate Site in the news section.

Regards,
Josef Dvorak

User avatar
Member
Member
Peter - 5/13/2013 4:39:35 AM
   
RE:Edit document webpart form
Thanks Josef,

I'm trying to use a webpart as I need to do some custom coding from behind. Also I'm placing the webpart in a tab container.
Currently I'm using a cms unigrid were I setup the editing buttons.

Do you have any examples of how to use basicForm, DataForm etc?

Peter

User avatar
Certified Developer 13
Certified Developer 13
kentico_josefd - 5/21/2013 8:11:50 AM
   
RE:Edit document webpart form
Hello,

Unfortunately we do not have any such examples. I have noticed you were solving the issue with FroggEye. Were you able to achieve what you needed?

Regards,
Josef Dvorak

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/13/2013 7:09:25 AM
   
RE:Edit document webpart form
Maybe ask yourself if you need to have a document type. Maybe a custom table would serve you better. If so check out this webpart in the marketplace.

If the person editing the doc type doesn't have access to the CMSDesk then you would be best to create your own webpart. You could take some inspiration from the webpart I mentioned above to set the selected item and display an alternative from if you'd like. Again, its setup for custom tables but you could apply it to a document type if you took the time to convert it.

User avatar
Member
Member
Peter - 5/13/2013 5:55:04 PM
   
RE:Edit document webpart form
Hi,
I do actually need to create a document type.

The document type should display a lawyer profile which is managed by a group manager on a manager portal. So on this portal I've placed a webpart which lists all the lawyers associated with their manager who can maintain them.
Then all the lawyers from all managers are displayed on the web - 1 page profile per lawyer.

I did manage to display editing form using cms:dataform but there are some problems and I would like to know or see some examples of it how to do it properly.


I hope I've explained the situation.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/14/2013 7:39:52 AM
   
RE:Edit document webpart form
Ok sounds fair. So what are the problems you are having?

User avatar
Member
Member
Peter - 5/14/2013 5:17:39 PM
   
RE:Edit document webpart form
Thanks FroggEye for your reply.

I have followed the article on cms form engine http://devnet.kentico.com/Videos/API/Kentico-CMS-Form-Engine.aspx and used the example attached - basicform

I get the form item using
IDataClass formItem = DataClassFactory.NewDataClass(className, itemId);

the following line changed as there is no DataRow in formItem
//this.form.DataRow = formItem.DataRow;
this.form.DataRow = formItem.GetDataSet().Tables[0].Rows[0];

Then I get the following error
[NullReferenceException: Object reference not set to an instance of an object.]
CMS.FormControls.EditingFormControl.CreateChildControls() +104
System.Web.UI.Control.EnsureChildControls() +83
CMS.FormControls.Layout.CreateEditingFormControl(FormFieldInfo ffi) +216
CMS.FormControls.LayoutForm.AddFormElement(FormFieldInfo ffi, String ffType, String ffName) +184
CMS.FormControls.LayoutForm.GenerateMacroContent(Match match, Int32& actualPos) +192
CMS.FormControls.LayoutForm.LoadLayout() +179
CMS.FormControls.BasicForm.LoadFormLayout() +92
CMS.FormControls.BasicForm.LoadData(IDataContainer data) +1237
CMS.FormControls.BasicForm.CreateChildControls() +42
System.Web.UI.Control.EnsureChildControls() +83
CMS.FormControls.BasicForm.OnLoad(EventArgs e) +42
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/14/2013 10:22:13 PM
   
RE:Edit document webpart form
That video looks like it was for v5. I suggest checking out the documentation for the API here. It will show you how to insert, update and delete biz form records.