ASPX templates
Version 7.x > ASPX templates > Customize EditForm in Contribution List View modes: 
User avatar
Member
Member
poplooukhin-gmail - 4/7/2014 11:49:05 PM
   
Customize EditForm in Contribution List
Hi, all

I have a two document types: "MyObject", "OverridedMyObject".
I added alternative forms for them.
I use contributionlist web part for CRUD operations with "MyObject" and "OverridedMyObject".

The "MyObject" and "OverridedMyObject" contains "Type" field that has string type and displayed as dropdown list with fixed set of values.

I have a two questions:

1. How can I get event that selected "Type" in dropdown list was changed? (I wouldn't like to implement the custom form control for that).

2. How can I set value to field of the "EditForm" in the "Contribution List" web part?

I tryed to do this like:

private void EditForm_OnAfterDataLoad(object sender, EventArgs e)
{

var frmInfo = FormHelper.GetFormInfo(this.list.EditForm.CMSForm.Node.ClassName, false);
var fieldInfo = frmInfo.ItemsList.OfType<FormFieldInfo>().SingleOrDefault(x => x.Name == "display_name");
fieldInfo.SetValue("display_name", "ha ha ha");
fieldInfo.DefaultValue = "ha ha ha";
frmInfo.UpdateFormField("display_name", fieldInfo);
}

But the above code doesn't work.