Validator/Textbox/Label Bug

Discussion in 'ASP .Net Web Controls' started by Scott, May 5, 2004.

  1. Scott

    Scott Guest

    I have a textbox to enter an email address followed by a password
    textbox. The email has a regularexpressionvalidator and a
    requiredfieldvalidator. The ReqField works fine, but if I put in an
    invalid email addy then click in the password field below, something
    very odd happens.

    The password label & textbox (and all controls below) shift down one
    line, and rather than having my cursor in the password textbox. The
    cursor is IN the label. I can now type in text in the LABEL.. I can
    also backspace out the text in the label AND continue backspacing and
    elminate the email textbox, the email label and the controls above
    (limited by the TD cell these items are in).

    If I use the tab button to move from the incorrectly entered email
    addy to the password field, everything shifts down still, but the
    cursor is where it should be. The shift is annoying, but obviously
    there's much more going on here than an aesthetic glitch.

    Has anyone experienced anything similar to this? Know what I can do
    to fix it??

    The bit of code having the problem is pasted below.

    -Scott

    << problem code >>

    <p>Email:<br>
    <asp:textbox size="25" id="Email" runat="server" />&nbsp;

    <asp:regularexpressionvalidator controltovalidate="Email"
    validationexpression="[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+"
    display="Dynamic" errormessage="Must use a valid email address."
    runat="server" id="RegularExpressionValidator1" />

    <asp:requiredfieldvalidator controltovalidate="Email"
    errormessage="'Email' must not be left blank." runat="server"
    id="RequiredFieldValidator2" />

    <p>Password:<br>
    <asp:textbox size="25" id="Password" textmode="Password"
    runat="server" />&nbsp;

    <asp:requiredfieldvalidator controltovalidate="Password"
    errormessage="'Password' must not be left blank." runat="server"
    id="RequiredFieldValidator3" />

    << end problem code >>
     
    Scott, May 5, 2004
    #1
    1. Advertising

  2. Hi Scott,

    I couldn't reproduce this problem, but I noticed that your code has illegal
    "size" attributes which should normally be "width".
    Also, you are mixing static and dynamic in the validators which could be
    causing your problem.

    Are you using absolute positioning anywhere? Are there tables that are
    constricting the flow? Perhaps you can show the whole page to help us
    analyze it?

    Here's the code I was using:

    <form id="Form1" method="post" runat="server">
    Email:<br>
    <asp:textbox id="Email" runat="server" />&nbsp;
    <asp:regularexpressionvalidator controltovalidate="Email"
    validationexpression="[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+"
    errormessage="Must use a valid email address." runat="server"
    id="RegularExpressionValidator1" />
    <asp:requiredfieldvalidator controltovalidate="Email"
    errormessage="'Email' must not be left blank." runat="server"
    id="RequiredFieldValidator2" />
    Password:<br>
    <asp:textbox id="Password" textmode="Password" runat="server" />&nbsp;
    <asp:requiredfieldvalidator controltovalidate="Password"
    errormessage="'Password' must not be left blank." runat="server"
    id="RequiredFieldValidator3" />
    </form>

    Ken
    Microsoft MVP [ASP.NET]



    "Scott" <> wrote in message
    news:...
    >I have a textbox to enter an email address followed by a password
    > textbox. The email has a regularexpressionvalidator and a
    > requiredfieldvalidator. The ReqField works fine, but if I put in an
    > invalid email addy then click in the password field below, something
    > very odd happens.
    >
    > The password label & textbox (and all controls below) shift down one
    > line, and rather than having my cursor in the password textbox. The
    > cursor is IN the label. I can now type in text in the LABEL.. I can
    > also backspace out the text in the label AND continue backspacing and
    > elminate the email textbox, the email label and the controls above
    > (limited by the TD cell these items are in).
    >
    > If I use the tab button to move from the incorrectly entered email
    > addy to the password field, everything shifts down still, but the
    > cursor is where it should be. The shift is annoying, but obviously
    > there's much more going on here than an aesthetic glitch.
    >
    > Has anyone experienced anything similar to this? Know what I can do
    > to fix it??
    >
    > The bit of code having the problem is pasted below.
    >
    > -Scott
    >
    > << problem code >>
    >
    > <p>Email:<br>
    > <asp:textbox size="25" id="Email" runat="server" />&nbsp;
    >
    > <asp:regularexpressionvalidator controltovalidate="Email"
    > validationexpression="[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+"
    > display="Dynamic" errormessage="Must use a valid email address."
    > runat="server" id="RegularExpressionValidator1" />
    >
    > <asp:requiredfieldvalidator controltovalidate="Email"
    > errormessage="'Email' must not be left blank." runat="server"
    > id="RequiredFieldValidator2" />
    >
    > <p>Password:<br>
    > <asp:textbox size="25" id="Password" textmode="Password"
    > runat="server" />&nbsp;
    >
    > <asp:requiredfieldvalidator controltovalidate="Password"
    > errormessage="'Password' must not be left blank." runat="server"
    > id="RequiredFieldValidator3" />
    >
    > << end problem code >>
     
    Ken Cox [Microsoft MVP], May 7, 2004
    #2
    1. Advertising

  3. Scott

    Scott Guest

    Ken,

    Hi, thanks for your response.

    I replaced the "size" attribute with "width" and made both validators
    dynamic (on email & verify password) and that fixed the problem. I'm
    pretty sure I had tried making both dynamic before w/o resolving the
    issue, so it seems to have been a combination of the dynamic/static
    and the illegal "size" attribute. Also, the code in question was
    inside a fixed width table cell (width=450) which probably was also
    necessary to get the odd behaviour (and accounts for you not being
    able to duplicate the problem).

    Anyway, it's working great now, thanks again for your input.

    -Scott



    "Ken Cox [Microsoft MVP]" <> wrote in message news:<>...
    > Hi Scott,
    >
    > I couldn't reproduce this problem, but I noticed that your code has illegal
    > "size" attributes which should normally be "width".
    > Also, you are mixing static and dynamic in the validators which could be
    > causing your problem.
    >
    > Are you using absolute positioning anywhere? Are there tables that are
    > constricting the flow? Perhaps you can show the whole page to help us
    > analyze it?
    >
    > Here's the code I was using:
    >
    > <form id="Form1" method="post" runat="server">
    > Email:<br>
    > <asp:textbox id="Email" runat="server" />&nbsp;
    > <asp:regularexpressionvalidator controltovalidate="Email"
    > validationexpression="[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+"
    > errormessage="Must use a valid email address." runat="server"
    > id="RegularExpressionValidator1" />
    > <asp:requiredfieldvalidator controltovalidate="Email"
    > errormessage="'Email' must not be left blank." runat="server"
    > id="RequiredFieldValidator2" />
    > Password:<br>
    > <asp:textbox id="Password" textmode="Password" runat="server" />&nbsp;
    > <asp:requiredfieldvalidator controltovalidate="Password"
    > errormessage="'Password' must not be left blank." runat="server"
    > id="RequiredFieldValidator3" />
    > </form>
    >
    > Ken
    > Microsoft MVP [ASP.NET]
    >
    >
    >
    > "Scott" <> wrote in message
    > news:...
    > >I have a textbox to enter an email address followed by a password
    > > textbox. The email has a regularexpressionvalidator and a
    > > requiredfieldvalidator. The ReqField works fine, but if I put in an
    > > invalid email addy then click in the password field below, something
    > > very odd happens.
    > >
    > > The password label & textbox (and all controls below) shift down one
    > > line, and rather than having my cursor in the password textbox. The
    > > cursor is IN the label. I can now type in text in the LABEL.. I can
    > > also backspace out the text in the label AND continue backspacing and
    > > elminate the email textbox, the email label and the controls above
    > > (limited by the TD cell these items are in).
    > >
    > > If I use the tab button to move from the incorrectly entered email
    > > addy to the password field, everything shifts down still, but the
    > > cursor is where it should be. The shift is annoying, but obviously
    > > there's much more going on here than an aesthetic glitch.
    > >
    > > Has anyone experienced anything similar to this? Know what I can do
    > > to fix it??
    > >
    > > The bit of code having the problem is pasted below.
    > >
    > > -Scott
    > >
    > > << problem code >>
    > >
    > > <p>Email:<br>
    > > <asp:textbox size="25" id="Email" runat="server" />&nbsp;
    > >
    > > <asp:regularexpressionvalidator controltovalidate="Email"
    > > validationexpression="[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+"
    > > display="Dynamic" errormessage="Must use a valid email address."
    > > runat="server" id="RegularExpressionValidator1" />
    > >
    > > <asp:requiredfieldvalidator controltovalidate="Email"
    > > errormessage="'Email' must not be left blank." runat="server"
    > > id="RequiredFieldValidator2" />
    > >
    > > <p>Password:<br>
    > > <asp:textbox size="25" id="Password" textmode="Password"
    > > runat="server" />&nbsp;
    > >
    > > <asp:requiredfieldvalidator controltovalidate="Password"
    > > errormessage="'Password' must not be left blank." runat="server"
    > > id="RequiredFieldValidator3" />
    > >
    > > << end problem code >>
     
    Scott, May 10, 2004
    #3
  4. Hey Scott,

    Glad to hear you got things going!

    Ken


    "Scott" <> wrote in message
    news:...
    > Ken,
    >
    > Hi, thanks for your response.
    >
    > I replaced the "size" attribute with "width" and made both validators
    > dynamic (on email & verify password) and that fixed the problem. I'm
    > pretty sure I had tried making both dynamic before w/o resolving the
    > issue, so it seems to have been a combination of the dynamic/static
    > and the illegal "size" attribute. Also, the code in question was
    > inside a fixed width table cell (width=450) which probably was also
    > necessary to get the odd behaviour (and accounts for you not being
    > able to duplicate the problem).
    >
    > Anyway, it's working great now, thanks again for your input.
    >
    > -Scott
    >
    >
    >
     
    Ken Cox [Microsoft MVP], May 10, 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. S. Justin Gengo
    Replies:
    0
    Views:
    576
    S. Justin Gengo
    Jul 16, 2003
  2. Scott

    Validator/Textbox/Label Bug

    Scott, Apr 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    760
    Scott
    Apr 22, 2004
  3. =?Utf-8?B?VmVua2k=?=

    Validator error message label becomes editable - Bug

    =?Utf-8?B?VmVua2k=?=, Sep 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    503
    Hermit Dave
    Sep 25, 2004
  4. Replies:
    4
    Views:
    947
    Richter~9.6
    Feb 13, 2007
  5. Knut Krueger
    Replies:
    8
    Views:
    325
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page