Copied to clipboard

Flag this post as spam?

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


  • Will Phillips 8 posts 145 karma points c-trib
    Aug 08, 2013 @ 16:56
    Will Phillips
    1

    Contour generates empty action attribute

    Just found that contour renders a form on a page with an empty action attribute which creates invalid Html, as far as I am aware the form works perfectly, I came across this article but most of it goes over my head.

     

    http://www.jarredcapellman.com/2013/4/28/MVC4-Form-Action-Empty-when-using-Html.BeginForm

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 29, 2013 @ 00:50
    Nicholas Westby
    0

    I'm experiencing this too. I think it might have something to do with the fact that I am hijacking routes (or maybe because I created a custom global.asax.cs that inherits from UmbracoApplication and sets up Ninject IoC/DI). I'm thinking that whatever Contour does to register routes never happens, so any BeginForm that uses the controller/action of FormRender/ContourForm will not produce a valid route.

    Seems like this would be a pretty common scenario, but I'm not sure how others have handled this. Maybe they register the route for Contour?

    Anybody tried this before?

  • Henri Toivonen 77 posts 111 karma points
    Sep 20, 2013 @ 09:56
    Henri Toivonen
    0

    Me three. Annoying since it means the sites do not pass the w3c validator.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 16, 2013 @ 10:55
    Jeavon Leopold
    1

    I think this article could explain the issue further but it is going to require fixing in Contour

  • Comment author was deleted

    Oct 16, 2013 @ 11:05

    @Jeavon awesome, I'll take a look :)

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 16, 2013 @ 12:10
    Jeavon Leopold
    0

    @Tim cool! Also if you are making Contour changes a small amendment is required in contour.js to stop it trying to submit every form on the page that has a submit button,

    $('input[type=submit]').click(function (evt) {
    

    should be changed to

    $('#contour input[type=submit]').click(function (evt) {
    
  • Comment author was deleted

    Oct 21, 2013 @ 10:10

    ok thanks Jeavon taking a look today at this one :)

  • Roel Snetselaar 151 posts 305 karma points
    Feb 09, 2014 @ 16:07
    Roel Snetselaar
    0

    I know this is an old topic. But the empty action attribute is still there. I'm currently using Contour 3.0.18. Any chance this will be fixed Tim?

  • Comment author was deleted

    Feb 11, 2014 @ 09:24

    Yeah taking a look now

  • Comment author was deleted

    Feb 11, 2014 @ 09:40

    Or if you need a different action you can also set it setting to # or ? should also be valid

  • Comment author was deleted

    Feb 11, 2014 @ 09:41

    Hmm previous post is gone so soluton is to update form view

     

            @using (Html.BeginForm("ContourForm", "FormRender", FormMethod.Post, new { action=Request.ServerVariables["URL"] + "?" + Request.QueryString, enctype = "multipart/form-data" }))

  • Roel Snetselaar 151 posts 305 karma points
    Feb 15, 2014 @ 11:26
    Roel Snetselaar
    0

    Thanks Tim! This is working.

    Concerning invalid HTML (what this issue was about) I've found another one, when using a checkboxlist:

    "The for attribute of the label element must refer to a form control. …-9060-1e3f3b233fae" class="fieldLabel">Kies je eigen tijd </label>"

  • Comment author was deleted

    Feb 18, 2014 @ 16:27

    ok should be easy to update on the checkbloxlist view

  • Comment author was deleted

    Feb 18, 2014 @ 16:28

    hmm it already has that in place

  • Comment author was deleted

    Feb 18, 2014 @ 16:28

    could it be that you made adjustments to the view?

  • Roel Snetselaar 151 posts 305 karma points
    Feb 18, 2014 @ 20:44
    Roel Snetselaar
    0

    Thanks for checking Tim. I did not change the view: FieldType.CheckBoxList.cshtml

    This is what's in it (I also downloaded the latest version here and compared it using winmerge) http://our.umbraco.org/FileDownload?id=10426

    @model Umbraco.Forms.Mvc.Models.FieldViewModel
    <span class="checkboxlist" id="@Model.Id">

    @foreach (Umbraco.Forms.Mvc.Models.PrevalueViewModel pv in Model.PreValues)
    {

    <input type="checkbox" name="@Model.Name" id="@string.Concat(Model.Id,"_",pv.Id)" value="@pv.Value" 
    @if (Model.Mandatory) {<text>data-val="true" data-val-requiredlist="@Model.RequiredErrorMessage"</text>}
    @if (Model.ContainsValue(pv.Value)){<text>checked="checked"</text>}/>
    <label for="@string.Concat(Model.Id,"_",pv.Id)">@pv.Value</label>
    <br />
    

    }

    </span>

    and this is what the validator says: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.breienhaakvierdaagse.nl%2F&charset=%28detect+automatically%29&doctype=Inline&group=0#result

  • Roel Snetselaar 151 posts 305 karma points
    Feb 24, 2014 @ 21:44
    Roel Snetselaar
    0

    Any clue Tim? Or did I make a mistake somehow?

Please Sign in or register to post replies

Write your reply to:

Draft