multiple validators on textfield w/display=dynamic don't display correctly

Discussion in 'ASP .Net Web Controls' started by cp, Dec 21, 2004.

  1. cp

    cp Guest

    I have a regularexpressionvalidator and a
    requiredfieldvalidator attached to a textfield (that
    takes an email address). I also have a first name and
    last name field, each with a requiredfieldvalidator. I
    set the display=dynamic for all the validators. The error
    messages for the name fields work as I expect - i.e. the
    error displays or not depending on whether the error
    condition is met. The email field always displays an
    error once one of the error conditions on it is met. I
    expect it should not display once the error is fixed and
    the textbox loses focus. The error message updates
    correctly if I change, for example, an invalid email to
    no entry.

    Any suggestions on how to work around this or make the
    messages display (or not) "correctly"?

    Thanks,
    cp
    cp, Dec 21, 2004
    #1
    1. Advertising

  2. cp

    Jason Guest

    CP,
    Could you post your code?
    Jason
    Jason, Dec 21, 2004
    #2
    1. Advertising

  3. cp

    cp Guest

    Sure. I hope I'm not doing something stupid but
    everything works properly when I remove one of the
    validators on the email field. Thanks for any help.

    <table cellpadding="0" cellspacing="14" border="0">
    <tr>
    <td class="adminBoxText" align="right"
    nowrap><nobr>First name:</nobr></td>
    <td class="adminBoxText"
    align="left"><asp:textbox id=txtFirst
    cssclass="adminBoxInput" runat="server" />
    <asp:requiredfieldvalidator id=rfvFirst runat="server"
    display="Dynamic" forecolor="#ff0000"
    errormessage="Required"
    controltovalidate="txtFirst" /></td>
    </tr>
    <tr>
    <td class="adminBoxText" align="right"
    nowrap><nobr>Last name:</nobr></td>
    <td class="adminBoxText"
    align="left"><asp:textbox id=txtLast
    cssclass="adminBoxInput" runat="server" />
    <asp:requiredfieldvalidator id=rfvLast runat="server"
    display="Dynamic" forecolor="#ff0000"
    errormessage="Required"
    controltovalidate="txtLast" /></td>
    </tr>
    <tr>
    <td class="adminBoxText" align="right"
    nowrap><nobr>Email address:</nobr></td>
    <td class="adminBoxText"
    align="left"><asp:textbox id=txtEmail
    cssclass="adminBoxInput" runat="server" />
    <asp:requiredfieldvalidator id=rfvEmail runat="server"
    display="Dynamic" forecolor="#ff0000"
    errormessage="Required"
    controltovalidate="txtEmail" /><asp:regularexpressionvalid
    ator id=revEmail runat="server" display="Dynamic"
    errormessage="Invalid email" controltovalidate="txtEmail"
    validationexpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-
    ..]\w+)*" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td height="30"
    valign="bottom"><asp:button id="btnSubmit" text="Submit"
    runat="server" />&nbsp;&nbsp;<input type="button"
    value="Cancel" onclick="history.back();"></td>
    </tr>
    </table>


    >-----Original Message-----
    >CP,
    >Could you post your code?
    >Jason
    >
    >.
    >
    cp, Dec 21, 2004
    #3
  4. cp

    Jason Guest

    Check out regexplib.com for a lot of good regular expressions :)
    Jason
    Jason, Dec 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ratman
    Replies:
    0
    Views:
    637
    Ratman
    Sep 14, 2004
  2. tshad
    Replies:
    2
    Views:
    458
    tshad
    Jan 27, 2005
  3. Steve Nobody

    ValidationSummary will not display dynamic validators.

    Steve Nobody, Feb 19, 2010, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    1,051
    Steve Nobody
    Feb 19, 2010
  4. Dynamic textfield

    , Nov 28, 2006, in forum: Javascript
    Replies:
    1
    Views:
    67
    Martin Honnen
    Nov 28, 2006
  5. Chuck

    Dynamic TextField Drop Down Pre-fill

    Chuck, Feb 21, 2008, in forum: Javascript
    Replies:
    2
    Views:
    164
    Joost Diepenmaat
    Feb 21, 2008
Loading...

Share This Page