PDA

View Full Version : Validator ctrl in table cell : Strange behaviour


sunny_doncaster
09-04-03, 10:51 AM
I have a table with several rows, each row contains a cell with a text box and a RegularExpressionsValidator control. This table cell is just wide enough to fit the text box so the validator message always ends up directly below.

This validator control has its display mode set to 'Dynamic' so the table cell and row height expands when the entry is invalid and the message is shown.

While testing the validator, I deliberately type in some invalid text that causes the validator control to show its error message.

Of course this does not happen until the text box has lost focus.

When I click the mouse to put the cursor in the text box below the cursor actually ends up in the error message displayed by the validator control that is now shown.
Stranger still I can actually edit the text of this error message or delete it completely.
Even stranger after deleting the message I can backspace and delete the text box above !!

(Pressing return results in the cursor ending up in the text box below).

Anybody got any clues whatsoever as to why this happens and maybe how to prevent it from happening ???

Any ideas would be greatly appreciated.

Sunny D

Shane
09-04-03, 01:41 PM
Sounds strange. Could you please post some code.

Stealth
09-04-03, 03:12 PM
its posessed!

sunny_doncaster
09-05-03, 04:00 AM
Originally posted by Shane
Sounds strange. Could you please post some code.

With pleasure....

The following is the asp code... this example is with a htmlinputfile control but it has the same effect as with a text box.

<%@ Page language="c#" Codebehind="UploadImageTest.aspx.cs" AutoEventWireup="false" Inherits="ImageUpload.UploadImageTest" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Upload Image(s) Text</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="frmUploadImagesTest" method="post" runat="server" encType="multipart/form-data">
<TABLE cellSpacing="5" cols="4" width="825" align="left">
<tr>
<td width="20"></td>
<td width="400">
<asp:Label ID="lblSelectFile" Runat="server">Select file :</asp:Label>
</td>
<td width="330">
<asp:Label ID="lblDescription" Runat="server">File description :</asp:Label>
</td>
<td width="50">
</td>
</tr>
<tr align="left">
<td width="20" valign="top" align="right" style="LEFT: 0px;POSITION: relative">
<asp:Label ID="lblInvalid1" Runat="server" Visible="True" CssClass="Data" ForeColor="red" Text="&nbsp;"></asp:Label>
</td>
<td width="400" align="left" valign="top" nowrap>
<input type="file" ID="fupUploadFile1" Runat="server" style="WIDTH : 400px" NAME="fupUploadFile">
<asp:RegularExpressionValidator ID="regExpValidatePath1" Runat="server" ControlToValidate="fupUploadFile1" Display="Dynamic" ValidationExpression='[^*"?<>|]*' ErrorMessage="One or more illegal characters in the path" >
</asp:RegularExpressionValidator>
</td>
<td width="330" align="left" valign="top">
<asp:TextBox Runat="server" ID="txtDescription1" Width="330" CssClass="Data"></asp:TextBox>
</td>
<td width="50" align="center" valign="top">
<asp:LinkButton ID="lnkViewImage1" NavigateUrl="" Target="_blank" href="" Runat="server">View</asp:LinkButton>
</td>
</tr>
<tr align="left">
<td width="20" valign="top" align="right" style="LEFT: 0px;POSITION: relative">
<asp:Label ID="lblInvalid2" Runat="server" Visible="True" CssClass="Data" ForeColor="red" Text="&nbsp;"></asp:Label>
</td>
<td width="400" align="left" valign="top">
<input type="file" ID="fupUploadFile2" Runat="server" style="WIDTH : 400px" NAME="fupUploadFile2">
<asp:RegularExpressionValidator ID="regExpValidatePath2" Runat="server" ControlToValidate="fupUploadFile2" Display="Dynamic" ValidationExpression='[^*"?<>|]*' ErrorMessage="One or more illegal characters in the path" >
</asp:RegularExpressionValidator>
</td>
<td width="330" align="left" valign="top">
<asp:TextBox Runat="server" ID="txtDescription2" Width="330" CssClass="Data"></asp:TextBox>
</td>
<td width="50" align="center" valign="top">
<asp:LinkButton ID="lnkViewImage2" NavigateUrl="" Target="_blank" href="" Runat="server">View</asp:LinkButton>
</td>
</tr>
<tr>
<td width="20">&nbsp;</td>
<td width="400">&nbsp;</td>
<td width="330">&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td width="20">&nbsp;</td>
<td width="400"><asp:button id="btnUploadImages" Runat="server"></asp:button></td>
<td width="330">&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td width="20">&nbsp;</td>
<td colspan="3" align="left">
<asp:Label style="TEXT-ALIGN: left" ID="lblMaxUploadSize" Enabled="False" Runat="server" Width="100%"
Text="" Font-Size="8"></asp:Label>
</td>
</tr>
<tr>
<td></td>
<td colspan="3" align="left">
<asp:Label style="TEXT-ALIGN: left" ID="lblMessage" Runat="server" Width="100%" Text=""></asp:Label>
</td>
</tr>
</TABLE>
</form>
</body>
</HTML>

Shane
09-05-03, 09:50 AM
hm.. your code runs normal for me. What browser are you using to test this?

This is an extremely weird case. I haven't heard anything like it. Has someone else tried executing it on your development machine from their computer?

gepstein
07-30-08, 09:55 AM
I have the same problem also, only on IE, Firefox works fine.

dobybest
07-31-08, 10:43 AM
Does anyone have any ideeas? Can somebody point at least to a good thread some place else?