I am new to umbraco contour and here is my situation:
I have multiple forms which are only accessable to umbraco members. When a member submits a form, I store their umbraco memberId as an entry. Instead of using the back office to see if a member has submitted the form, I am planing to develop a usercontrol that would grab this data from contour.
Is there any example around of what Im planning to do? If not, I would appreciate if someone can direct me to the right direction to get me started.
Contour has an API that you can use to query and get records out. You can also query it as XML for speed if you prefer. There are examples of how to use the API in the developer docs, which you can grab from here. You should be able to use those to work out the code that you need!
Thanks for letting me know about the dev doc. I already had read it but since I prefer to develop in c# so I didn't use the xml. Currently I am using the following logic to redirect members if they have already submitted a form
if (Member.IsLoggedOn())
{
RecordStorage rs = new RecordStorage();
Member m = Member.GetCurrentMember();
String currentMember = "";
currentMember = m.Id.ToString();
Guid form_guid = Guid.Parse("FORM_UUID");
Listform_records = new List();
form_records = rs.GetAllRecords(form_guid);
foreach (Record r in form_records)
{
String member = "";
member = r.GetRecordField("memberId").ValuesAsString();
if (member.Equals(currentMember))
{
Response.Redirect("/");
}
}
}
I want to render the form in user control if the user have not submitted it. any idea how can i achieve that?
Because later on I have to display multiple forms on the same page. So it will be clean if I can show/hide the required forms in one user control instead of creating separate user control for each form.
Accessing contour Form records in usercontrol
Hi,
I am new to umbraco contour and here is my situation:
I have multiple forms which are only accessable to umbraco members. When a member submits a form, I store their umbraco memberId as an entry. Instead of using the back office to see if a member has submitted the form, I am planing to develop a usercontrol that would grab this data from contour.
Is there any example around of what Im planning to do? If not, I would appreciate if someone can direct me to the right direction to get me started.
Thanks.
Hiya,
Contour has an API that you can use to query and get records out. You can also query it as XML for speed if you prefer. There are examples of how to use the API in the developer docs, which you can grab from here. You should be able to use those to work out the code that you need!
:)
Hi Tim,
Thanks for letting me know about the dev doc. I already had read it but since I prefer to develop in c# so I didn't use the xml. Currently I am using the following logic to redirect members if they have already submitted a form
if (Member.IsLoggedOn())
{
RecordStorage rs = new RecordStorage();
Member m = Member.GetCurrentMember();
String currentMember = "";
currentMember = m.Id.ToString();
Guid form_guid = Guid.Parse("FORM_UUID");
Listform_records = new List();
form_records = rs.GetAllRecords(form_guid);
foreach (Record r in form_records)
{
String member = "";
member = r.GetRecordField("memberId").ValuesAsString();
if (member.Equals(currentMember))
{
Response.Redirect("/");
}
}
}
I want to render the form in user control if the user have not submitted it. any idea how can i achieve that?
Because later on I have to display multiple forms on the same page. So it will be clean if I can show/hide the required forms in one user control instead of creating separate user control for each form.
Thanks
is working on a reply...