XForm posted data Label property

Vote:
 

Hi again,

I'm currently doing stuff where I need to parse posted XForm data by hand. I managed to get it working, the only difficult part was to read input/textarea/select/etc elements Label property which I handled with reflection. So basically my code calls XForm.CreateHtmlFragments(), filters out everything except XFormsFragment and uses .NET Reflection API to get Label property. Then I go through all the posted data by calling GetPostedData() and match every row against XFormsFragments.

Is there any other way to get the labels? I need the labels, not value keys. And if not, I have an suggestion for EpiServer people.

1. Create new simple interface

public interface IXFormsFragmentLabel { string Label { get; set; } }

2. Make all appropriate classes derived from XFormsFragment (InputFragment, SelectFragment, etc.) to implement this interface

public class InputFragment : XFormsFragment : IXFormsFragmentLabel { .. }

This way I wouldn't have to use Reflection API. I could just test if XFormsFragment is of type IXFormsFragmentLabel, cast it and read it's Label-property.

#65769
Feb 08, 2013 9:48
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.