Hi,
I have a popup screen which allowed user to enter the address.
Some fields are mandatory, so if user didn't enter for those fields, error message should show.
That popup screen don't have c# codes and totally no post back. All events/functions are done in Javascript.
Now the problem is the error message didn't show when I click on the 'Save' button. It just didn't close the popup screen cause of the mandatory fields.
I have tried to do a manual post back from javascript ('Form1.Submit();');
The text box are in red border and alert logo also shown, but the error message still not coming out.
Please help.
Below is the source code for the popup screen.
I have a popup screen which allowed user to enter the address.
Some fields are mandatory, so if user didn't enter for those fields, error message should show.
That popup screen don't have c# codes and totally no post back. All events/functions are done in Javascript.
Now the problem is the error message didn't show when I click on the 'Save' button. It just didn't close the popup screen cause of the mandatory fields.
I have tried to do a manual post back from javascript ('Form1.Submit();');
The text box are in red border and alert logo also shown, but the error message still not coming out.
Please help.
Below is the source code for the popup screen.
| <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <title></title> |
| <style type="text/css" media="all"> |
| @import "/css/standard.css"; |
| </style> |
| <script src="/js/jquery-1.2.6.min.js" type="text/javascript"></script> |
| <script src="/js/common.js" type="text/javascript"></script> |
| <script language="javascript" type="text/javascript"> |
| function GetRadWindow(){ |
| var oWindow = null; |
| if (window.radWindow) oWindow = window.radWindow; |
| else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
| return oWindow; |
| } |
| function PopulateData() |
| { |
| var oObject = GetRadWindow().argument; |
| document.getElementById('txtAddressLine1').value = oObject.Company; |
| document.getElementById('txtAddressLine2').value = oObject.Address1; |
| document.getElementById('txtAddressLine3').value = oObject.Address2; |
| document.getElementById('txtCity').value = oObject.City; |
| document.getElementById('txtState').value = oObject.State; |
| document.getElementById('txtCountry').value = oObject.Country; |
| document.getElementById('txtPostal').value = oObject.Postcode; |
| document.getElementById('txtAddressLine1').readOnly = oObject.ReadOnly; |
| document.getElementById('txtAddressLine2').readOnly = oObject.ReadOnly; |
| document.getElementById('txtAddressLine3').readOnly = oObject.ReadOnly; |
| document.getElementById('txtCity').readOnly = oObject.ReadOnly; |
| document.getElementById('txtState').readOnly = oObject.ReadOnly; |
| document.getElementById('txtCountry').readOnly = oObject.ReadOnly; |
| document.getElementById('txtPostal').readOnly = oObject.ReadOnly; |
| if (oObject.ReadOnly) |
| { |
| document.getElementById('btnSave').style.visibility = "hidden"; |
| document.getElementById('divButton').style.visibility = "hidden"; |
| } |
| else |
| { |
| document.getElementById('btnSave').style.visibility = "visible"; |
| document.getElementById('divButton').style.visibility = "visible"; |
| } |
| } |
| function returnToParent(strMode) |
| { |
| //create the argument that will be returned to the parent page |
| var arg = new Object(); |
| if( (strMode != null) && (strMode == 'Save')) |
| { |
| arg.Company = document.getElementById('txtAddressLine1').value; |
| arg.Address1 = document.getElementById('txtAddressLine2').value; |
| arg.Address2 = document.getElementById('txtAddressLine3').value; |
| arg.City = document.getElementById('txtCity').value; |
| arg.State = document.getElementById('txtState').value; |
| arg.Country = document.getElementById('txtCountry').value; |
| arg.Postcode = document.getElementById('txtPostal').value; |
| } |
| //get a reference to the current RadWindow |
| var oWnd = GetRadWindow(); |
| //Close the RadWindow and send the argument to the parent page |
| oWnd.close(arg); |
| } |
| </script> |
| </head> |
| <body onload="PopulateData()"> |
| <form id="form1" runat="server"> |
| <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="Default, Label" /> |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"> |
| </telerik:RadAjaxLoadingPanel> |
| <telerik:RadAjaxPanel ID="ajaxPanelAccount" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| <telerik:RadInputManager ID="radMgrMandatoryFields" runat="server"> |
| <telerik:RegExpTextBoxSetting BehaviorID="mandatoryField" EmptyMessage="<%$ Resources:Error, MandatoryCardGroupName %>" |
| ErrorMessage="<%$ Resources:Error, MandatoryCardGroupName %>" IsRequiredFields="true"> |
| <TargetControls> |
| <telerik:TargetInput ControlID="txtAddressLine1"/> |
| <telerik:TargetInput ControlID="txtCity"/> |
| <telerik:TargetInput ControlID="txtCountry"/> |
| <telerik:TargetInput ControlID="txtPostal"/> |
| </TargetControls> |
| </telerik:RadInputManager> |
| <div> |
| <table width="98%" cellpadding="10px"> |
| <tr> |
| <td> |
| <div id="tb_card_settings"> |
| <h2> |
| <asp:Literal ID="ltrlDeliveryAddressTitle" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlDeliveryAddressTitle%>"></asp:Literal> |
| </h2> |
| <div> |
| <div class=""> |
| <table> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlAddressLine1" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlAddressLine1 %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtAddressLine1" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlAddressLine2" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlAddressLine2 %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtAddressLine2" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlAddressLine3" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlAddressLine3 %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtAddressLine3" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlCity" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlCity %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtCity" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlState" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlState %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtState" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlCountry" runat="server" Text="<%$ Resources:Common, ltrlCountry %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtCountry" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="width:30%"> |
| <asp:Literal ID="ltrlPostal" runat="server" Text="<%$ Resources:DeliveryAddress.aspx, ltrlPostal %>"></asp:Literal> |
| </td> |
| <td style="width:70%"> |
| <asp:TextBox ID="txtPostal" runat="server"></asp:TextBox> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| <p></p> |
| <div Id="divButton" runat="server"> |
| <p class="buttons"> |
| <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:Button, btnSave %>" OnClientClick="returnToParent('Save'); return false;" /> |
| </p> |
| </div> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </telerik:RadAjaxPanel> |
| </form> |
| </body> |
| </html> |