Copied to clipboard

Flag this post as spam?

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

  • Simon Dingley 1433 posts 3334 karma points c-trib
    Jun 08, 2017 @ 11:40
    Simon Dingley

    Hidden Div with Text Field in Default Razor View for Forms

    I am working on some fixes to help a customer become WCAG 2.0 compliant on their government site and found that by default all forms seem to include the following code:

    <div style="display: none">
        <input type="text" name="@Model.FormId.ToString().Replace("-", "")" />

    Firstly, why is this a text field in a hidden div and not a hidden field? Secondly, what is it's purpose given that forms already have the following?

    <input type="hidden" name="FormId" value="@Model.FormId" />

    I can fix the compliance issue easy enough but want to understand the implementation so I can assess the impact of the options for addressing it.

    Thanks, Simon

  • Alex Meyers 25 posts 106 karma points
    Apr 10, 2018 @ 11:45
    Alex Meyers

    Hi Simon,

    I've just created an issue for this -

    This issue was identified by a number of accessibility testing tools we have used on a recent project.

  • Daniel Chenery 119 posts 465 karma points
    Apr 10, 2018 @ 22:33
    Daniel Chenery

    I'm pretty sure this is the honeypot field. Try filling it out, the submission should fail.

    My guess is it isn't type="hidden" to prevent spam bots from finding it.

    The div could probably be replaced with a label though.

Please Sign in or register to post replies

Write your reply to: