returns prevalues from another prevalue of the same type.
I have a custom prevaluetype which takes an Xpath string and a node id as settings. I have configured 2 prevalues using this type, one called FOO and one called BAR with different xpath. I have 2 forms A and B. Form A has radiobuttons with prevalue FOO and form B has radiobuttons with prevalues from BAR.
I load form A using the API (and dispose of the form storage). I then try to access prevalues for the field using
Checking PreValueSource.Name, Form.AllFields[7].PreValueSource.Name, returns FOO while Form.AllFields[7].PreValueSource.Type.FieldPreValueSource.Name returns BAR.
I tried messing around with that. It seems to always want me to pass in field though. I don't have a field to pass in.
var pss = new Umbraco.Forms.Data.Storage.PrevalueSourceStorage();
var ps = pss.GetPrevalueSource(new Guid("a693970f-c74e-4c1b-8130-f8f2fc5900f2")); // guid for PrevalueSource
var pv = ps.Type.GetPreValues(WANTS A CONTOUR FIELD);
API not returning correct prevalues for Field
Hi
I'm trying to retrieve prevalues from a Field using the API based on http://our.umbraco.org/forum/umbraco-pro/contour/12438-Getting-prevalues-through-the-API
using
returns prevalues from another prevalue of the same type.
I have a custom prevaluetype which takes an Xpath string and a node id as settings.
I have configured 2 prevalues using this type, one called FOO and one called BAR with different xpath.
I have 2 forms A and B. Form A has radiobuttons with prevalue FOO and form B has radiobuttons with prevalues from BAR.
I load form A using the API (and dispose of the form storage). I then try to access prevalues for the field using
however this returns prevalues from BAR not FOO.
Checking PreValueSource.Name, Form.AllFields[7].PreValueSource.Name, returns FOO while Form.AllFields[7].PreValueSource.Type.FieldPreValueSource.Name returns BAR.
This is on Contour version 1.1.3
Thanks,
Harald
Comment author was deleted
Hi Harald,
You should do an explicit load settings first, f.PreValueSource.Type.LoadSettings(f.PreValueSource);
Regards,
Tim
Is there a way to load prevalues directly from the source without having to get them from a field?
Comment author was deleted
Sure there is a prevalue storage
Check Umbraco.Forms.Data.Storage.PrevalueSourceStorage
@Tim
I tried messing around with that. It seems to always want me to pass in field though. I don't have a field to pass in.
is working on a reply...