Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Closed Issue: Small javascript fix for ValidatorCallout after async postback [11561]

$
0
0
if you have some code like bellow, after the async postback the validation fail and the position too (validatorcallout in pos 0,0 :) )... i did small javascript change in ValidatorCalloutBehavior.js for solve the problem (and also the overload when you have a lot of validators, ie, the table will write after focus and not when the page load)... please check the attachment and let me know any enhancement (specially with the try catch for the focus handler :S i search other solutions but was the unique that solve the validations). dont forget... the validations must be out of the update panel....

<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<div class="demoarea">
<div class="demoheading">
ValidatorCallout Demonstration</div>
<asp:RequiredFieldValidator runat="server" ID="NReq" ControlToValidate="NameTextBox" ErrorMessage="<b>Required Field Missing</b><br />A name is required." />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="NReqE" TargetControlID="NReq"
HighlightCssClass="validatorCalloutHighlight" />
<asp:RequiredFieldValidator runat="server" ID="PNReq" ControlToValidate="PhoneNumberTextBox" ErrorMessage="<b>Required Field Missing</b><br />A phone number is required.<div style='margin-top:5px;padding:5px;border:1px solid #e9e9e9;background-color:white;'><b>Other Options:</b><br /><a href='javascript:alert(&quot;No phone number available in profile.&quot;);'>Extract from Profile</a></div>" />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="PNReqE" TargetControlID="PNReq"
HighlightCssClass="validatorCalloutHighlight" Width="350px" />
<asp:RegularExpressionValidator runat="server" ID="PNRegEx" ControlToValidate="PhoneNumberTextBox" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" ErrorMessage="<b>Invalid Field</b><br />Please enter a phone number in the format:<br />(###) ###-####" />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="PNReqEx" TargetControlID="PNRegEx"
HighlightCssClass="validatorCalloutHighlight" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
Name:</td>
<td>
<asp:TextBox runat="server" ID="NameTextBox" BorderStyle="solid" BorderWidth="1px"
BorderColor="#a9a9a9" /></td>
</tr>
<tr>
<td>
Phone Number:</td>
<td>
<asp:TextBox runat="server" ID="PhoneNumberTextBox" BorderStyle="solid" BorderWidth="1px"
BorderColor="#a9a9a9" /></td>
</tr>
</table>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_OnClick" /><br />
<br />
<asp:Label ID="lblMessage" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
DisplayAfter="100">
<ProgressTemplate>
cargando...
</ProgressTemplate>
</asp:UpdateProgress>
</form>

pd: my english is not good, i hope that you understand :)
Comments: This ticket was filed for a pre-15.1 version of AJAX Control Toolkit. If this is still an issue in v15.1 or later, please create a new inquiry.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>