In the end I gave up and worked around the issue using an event handler to post information out to the other system.
Still interested in other answers and suggestions.
using Umbraco.Core;
using Umbraco.Forms.Core;
using Umbraco.Forms.Data.Storage;
namespace blar.Forms
{
public class UmbracoFormsListener : ApplicationEventHandler
{
protected override void ApplicationStarted(
UmbracoApplicationBase umbracoApplication,
ApplicationContext applicationContext)
{
//Listen for when form changes is being saved
FormStorage.Created += new EventHandler<FormEventArgs>(FormStorage_FormCreated);
FormStorage.Saved += new EventHandler<FormEventArgs>(FormStorage_FormSaved);
FormStorage.Deleted += new EventHandler<FormEventArgs>(FormStorage_FormDelete);
}
....
}
I hope this is the correct thread to query. If not, please accept my apologies.
I am trying to find out more about the Forms API. I have read the documents on this site which confirm that data queried from Forms comes back as a dynamic object and that the static methods can be found within Umbraco.Forms.Mvc.DynamicObjects.Library.
Unfortunately, I am a newbie to Umbraco, Razor, and C#. I have been learning more about C# and how classes and namespaces work, but my background is JS, not C#.
Through trial and error, and cobbling together information from other threads, I have been able to retrieve the prevalues for a list of options in the form as follows:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Umbraco.Forms.Mvc.DynamicObjects
<ul>
@foreach (dynamic record in Library.GetApprovedRecordsFromFormOnPage(@CurrentPage.Id, "myFormID").OrderBy("Created"))
{
<li>
@foreach( var field in record.RecordFields )
{
var prev1=field.Value.Field.PreValues[0];
var prev2=field.Value.Field.PreValues[1];
}
}
However, how would I go about finding this sort of thing out in the future via a more direct route? I can't find any documentation which describes the deeper levels within the class beyond what is provided for in the brief discussion on the above-linked page.
I was able to list the properties of the returned Dynamic Records by using the following Razor code:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Umbraco.Forms.Mvc.DynamicObjects
@foreach (dynamic record in Library.GetApprovedRecordsFromFormOnPage(@CurrentPage.Id, "myFormID").OrderBy("Created"))
{
foreach(var prop in record.GetType().GetProperties()) {
<p>@prop.Name</p>
}
}
This information, however, is already available in the documentation linked above. How would I find out what is available within RecordFields (for example)?
Umbraco Forms - API?
Hi,
After an Umbraco guru for some quick advise :)
We're integrating Umbraco forms with another system. We have an external service that needs to be able.
Can you please point us in the direction of how to do this programmatically from a service that is not on the Umbraco server?
This has nothing to do with the data that is submitted but more to do with the form schema.
Many thanks for your help
Si
In the end I gave up and worked around the issue using an event handler to post information out to the other system.
Still interested in other answers and suggestions.
Hello,
I hope this is the correct thread to query. If not, please accept my apologies.
I am trying to find out more about the Forms API. I have read the documents on this site which confirm that data queried from Forms comes back as a dynamic object and that the static methods can be found within Umbraco.Forms.Mvc.DynamicObjects.Library.
Unfortunately, I am a newbie to Umbraco, Razor, and C#. I have been learning more about C# and how classes and namespaces work, but my background is JS, not C#.
Through trial and error, and cobbling together information from other threads, I have been able to retrieve the prevalues for a list of options in the form as follows:
However, how would I go about finding this sort of thing out in the future via a more direct route? I can't find any documentation which describes the deeper levels within the class beyond what is provided for in the brief discussion on the above-linked page.
I was able to list the properties of the returned Dynamic Records by using the following Razor code:
This information, however, is already available in the documentation linked above. How would I find out what is available within RecordFields (for example)?
Thank you.
is working on a reply...