I have a text box, webimagebutton on the form. textbox has a required field validator attached to it.
When i click on the webimagebutton, i have a method on the server which clears the value of the text box.
when i enter some value in the text box and reach to webimagebutton using tab and press space bar or Enter key, postback happens and the text box is cleared. this is expected. but the required field validator is showing error message. This is not correct. Can some one help on this? Thanks in advance.
What type of validatorare you using?
its a asp:RequiredFieldValidator
Unless I am not understanding something this sounds like its working correctly to me. What behavior are you wanting to happen. Lets look at it that way and see if that makes it any clearer.
Sorry if I'm not clear to you. When the postback happens i expect to see a empty textbox. But when submit the form by clicking space bar or Enter key, The textbox is cleared, but the required fields validator is displaying error message.
This is not the behaviour when i try to submit the form using mouse click. The textbox is cleared and the required field validator is not showing the error message. For me, this is correct behaviour and I expect the same behaviour when i submit the form by pressing the space bar or Enter key.
Hi Roundhouse_sw,
I was not able to reproduce that. I tested Chrome for a website which form contained following:
<igtxt:WebImageButton ID="WebImageButton1" runat="server" Text="ImgBut"></igtxt:WebImageButton><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextBox1">*</asp:RequiredFieldValidator>
When I clicked text box, entered "123" or any other value, and clicked button, then postback happened. The validation error message did not appear.
If that sample is not correct or misses something, then please, send me codes which can be used to reproduce that issue.
I seem to have a browser specific problem (as per the issue reported in htis post). The IE browser work OK with validation. However Google Chrome does not. If I enter a value in MY text box then click the submit button (on chrome), then the validation does not detect the new text in the webtext control - so the submit is not permitted. Which is WRONG. However If I enter text in the tetx box and tab to another control and then click the submit button, the text is detetcted and the validation is OK.
I'm using ASP2.NET. The validation is for a required value in the text box : <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate ="txtCustRef">*</asp:RequiredFieldValidator>
Thanks a lot. The issue is resolved after i copied the attached js file.
Hi,
Thank you for codes. They are identical to my tests, but they contained version of dll and that helped me to reproduce issue. When I copied to my project ig_button.js file from 7.1.20071.1061 installation, then it had behavior which you described.
I would suggest you to update NetAdvantage with latest hot-fix. If you cannot do that, then you may copy to the location of your aspx attached file and useJavaScriptFileName="./ig_button.js"for all WebImageButtons used on page.
I'm able to reproduce the behaviour with the above code also. Please see my complete code below.
<%@ Page language="c#" %><%@ Register TagPrefix="igtxt" Namespace="Infragistics.WebUI.WebDataInput" Assembly="Infragistics2.WebUI.WebDataInput.v7.1, Version=7.1.20071.1061, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML> <HEAD runat="server"> <title>Form1</title> </HEAD> <script runat="server">protected void WebImageButton1_Click(object sender, ButtonEventArgs e){ this.TextBox1.Text = "";}</script> <body MS_POSITIONING="GridLayout" style="margin:0"> <form id="Form1" method="post" runat="server"> <igtxt:WebImageButton ID="WebImageButton1" runat="server" onclick="WebImageButton1_Click" Text="Click"></igtxt:WebImageButton> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator> </form> </body></HTML>