Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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.