May 28, 2013, 8:25 PM
FormPanel Validation with Nested User Controls
Hi,
My forms were submitting fine using 2.1. After updating to 2.2, myform.getForm().isValid() is returning false even though all the required fields are filled out. I suspect that the problem is either the way the user controls are nested inside the formpanel or something was changed with the allowblank attribute in 2.2. I hoping you could point me in the right direction. Here is an example of the nested user controls:
My forms were submitting fine using 2.1. After updating to 2.2, myform.getForm().isValid() is returning false even though all the required fields are filled out. I suspect that the problem is either the way the user controls are nested inside the formpanel or something was changed with the allowblank attribute in 2.2. I hoping you could point me in the right direction. Here is an example of the nested user controls:
<ext:FormPanel runat="server" ID="lspFormPanel" Width="860" ButtonAlign="Center" >
<Items>
<%--Panel that contains General Instructions--%>
<ext:Panel ID="lspInstructions" runat="server" Header="false" Border="false" Hidden="false" Layout="FitLayout" >
<Content>
<uc1:Instructions ID="ucInstruct" runat="server" />
</Content>
</ext:Panel>
</Items>
<Buttons>
<ext:Button ID="btnSave" runat="server" Text="Save" Height="40" Icon="Disk" OnDirectClick="click_Save" />
<ext:Button ID="btnCancel" runat="server" Text="Cancel" Height="40" Icon="Cross" OnDirectClick="click_Cancel" />
<ext:Button ID="btnSubmit" runat="server" Text="Submit" Height="40" Icon="BasketAdd" >
<DirectEvents>
<Click OnEvent="checkValidation" ><Confirmation ConfirmRequest="true" Message="Are you sure that you want to submit this course proposal? No changes can be made after the initial submission." />
<EventMask ShowMask="true" Msg="Proposal is Submitting..." />
</Click>
</DirectEvents>
<Listeners>
<Click Handler = "if (#{lspFormPanel}.getForm().isValid()) return true; else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'Please check the fields and try again!', buttons:Ext.Msg.OK}); return false;}" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
Here is an example of the layout I use inside the user controls:<ext:Panel ID="pnl1" runat="server" Layout="AnchorLayout" >
<Items>
<ext:Panel ID="pnlInstr" runat="server" Border="false" Layout="FormLayout" >
<Items>
<ext:Label ID="lbl1" runat="server" Html="Test1" />
<ext:Label ID="lbl2" runat="server" Html="Test2" />
</Items>
</ext:Panel>
</Items>
</ext:Panel>