Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carlos 10 posts 80 karma points
    Oct 12, 2015 @ 17:55
    Carlos
    0

    Get the request data from umbracoforms

    Hi

    I am newbie in Umbraco. I need process the data from form in a new page.

    I have a form created with umbracoforms in Umbraco 7.2.8 with redirect to other page in the submit.

    How I can recover the data sent from the form in the final page?

    Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 12, 2015 @ 18:41
    Dennis Aaen
    0

    Hi Carlos and welcome to our :-),

    You can get the data from a form by Razor. Try to see this documentation

    https://our.umbraco.org/documentation/Add-ons/UmbracoForms/Developer/Working-With-Data/

    There is also an example code

    Hope this helps,

    /Dennis

  • Carlos 10 posts 80 karma points
    Oct 12, 2015 @ 19:54
    Carlos
    0

    Hi Dennis

    Thanks for your help

    I am using "var data = Umbraco.Forms.Mvc.DynamicObjects.Library.Dynamic. GetRecordsFromPage(CurrentPage.Id)" and "@data", but I don't have anything.

    If I put @using Umbraco.Forms.Mvc.DynamicObjects.Library I have error in compilation.

    Could you tell me what is wrong?

    Thank you

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 13, 2015 @ 07:41
    Dennis Aaen
    0

    Hi Carlos,

    If you are using a partial view or a partial view macro files, then you first need to add. @using Umbraco.Forms.Mvc.DynamicObjects

    Under @inherits UmbracoTemplatePage or @inherits Umbraco.Web.Macros.PartialViewMacroPage depending on which type of partial file that you are using.

    @using Umbraco.Forms.Mvc.DynamicObjects
    
    <ul id="comments">
     @foreach (dynamic record in Library.GetApprovedRecordsFromPage(@CurrentPage.Id).OrderBy("Created"))
     {
         <li>
              @record.Created.ToString("dd MMMM yyy")
              @if(string.IsNullOrEmpty(record.Website)){
                 <strong>@record.Name</strong>
              }
              else{
                 <strong>
                   <a href="@record.Website" target="_blank">@record.Name</a>
                 </strong>
              }
             <span>said</span>
            <p>@record.Comment</p>
         </li>
      }
    </ul>
    

    Then you should be able to get the data using this, and remember you need to add the partial view or partial view macro file on the page with the form.

    Hope this helps, and don't hesitate to ask more questions.

    /Dennis

  • Carlos 10 posts 80 karma points
    Oct 13, 2015 @ 15:49
    Carlos
    0

    Hello Dennis We could make the following example please: a form to send a number A and number B, in the results page get this data, them to the operations A + B and A * B Display these results on the results page.

    It is the first project in Umbraco and I'm a little lost in the forms only part.

    Thank you

  • Carlos 10 posts 80 karma points
    Oct 14, 2015 @ 21:49
    Carlos
    0

    Hello Denis

    I create a Partial View Macro File, but I can't connect this script calculo.cshtml with the form. Could you say me how Ican do it?

    Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 15, 2015 @ 06:33
    Dennis Aaen
    0

    Hi Carlos,

    You can do it in the same way as Tim show here http://umbraco.tv/videos/umbraco-v7/implementor/extending/umbraco-forms/adding-forms-to-your-templates/ hit the insert macro button and then choose the macro for the calculo.cshtml.

    You can also insert a macro into your rich text editor, try to see this video http://umbraco.tv/videos/umbraco-v7/implementor/extending/umbraco-forms/adding-forms-to-your-content/,

    As you can see we have a whole video chapter about Umbraco Forms http://umbraco.tv/videos/umbraco-v7/implementor/extending/umbraco-forms/

    Hope this helps,

    /Dennis

  • Carlos 10 posts 80 karma points
    Oct 15, 2015 @ 14:13
    Carlos
    0

    Hi Dennis

    I include the macro with "insert macro button", but I have the error:

    Error loading Partial View script (file: ~/Views/MacroPartials/mymacrofile.cshtml)

    Could you say me what is wrong?

    Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 15, 2015 @ 17:10
    Dennis Aaen
    0

    Hi Carlos,

    In order to get debug info for macros you can do a few things:

    • Use visual studio and set breakpoints
    • Enable tracing in your web.config and visit /trace.axd to get info like you used to get when using webforms (in MVC it's not possible to add this info inline with the page any more
    • Go into your ~./config/umbracoSettings.config and change the line to
      • this will give you errors right where the macro is in the page

    Of course you can also add logging yourself so you can see what's going on in your code. Another low key solution is that you break down your code it small bit, then you can see which line that throws the error.

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft