Copied to clipboard

Flag this post as spam?

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


  • Sam 184 posts 209 karma points
    Jan 31, 2011 @ 20:38
    Sam
    0

    Highlighting required fields

    Hi everyone,

    Is there a way of highlighting the actual required fields themselves once the form has been submitted incorrectly? ie instead of javascript adding the 'this field is required' text above the fieldset after submitting, the page reloads on submit and the actual field itself that is required has an extra/different class assigned to it so it can be styled out with css.

    In other words, rather than telling the user what fields they have missed above the form, can it be 0shown to them with a red border/background on the actual input field, something like that. Maybe doc2form can do this already, if so, please can someone show me how or point me in the right direction! :)

    Any ideas? Thanks in advance.

    Sam.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 01, 2011 @ 08:44
    Jan Skovgaard
    0

    Hi Sam

    I guess it should be possible to add styling with CSS. I must admit I can't remember if doc2form adds some styling when the form has been submitted with incorrect fields, so it reloads making users aware that something is wrong.

    But you could find out checking what happens using Firebug or another tool.

    But if you want to make users aware that they need to fill out some fields, before they submit I think you need to have some ajax-stuff going on.

    /Jan

  • Sam 184 posts 209 karma points
    Feb 01, 2011 @ 13:09
    Sam
    0

    Hi Jan,

    As it stands, if a field is missed (ie formName), on submit, the page doesn't reload, instead, a javascript runs and adds a <ul><li>Name is required</li></ul> above the form. This is ok but doesn't highlight the actual field where the error occured.

    What I would like would be more like (name="formName" class="required") which would change to (name="formName" class="required_error") on submit after subsequent page reload. Something like that and I could style it out the way I want with css with no need at all for ajax or anything flash whatsoever. I see the doc2form is a .cs file but I am just learning c# now and can't adapt it on my own to work the way I wanted.

    Sam.

Please Sign in or register to post replies

Write your reply to:

Draft