May 09, 2012, 9:30 AM
[CLOSED] Save FormPanel fields after Confirm Message
Hi, All
We are facing a problem with storing data on backend from a fompanel. We want to save form fields values to database but after confirmation message and also how to deal with comboboxes values in FormPanel. (Ext.Net 1.3)
Di you have any suggestions to retrieve fields values ?
We are facing a problem with storing data on backend from a fompanel. We want to save form fields values to database but after confirmation message and also how to deal with comboboxes values in FormPanel. (Ext.Net 1.3)
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form runat="server" >
<ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="TiersAjax">
</ext:ResourceManager>
<ext:Store ID="StoreCountry" runat="server">
<Reader>
<ext:JsonReader IDProperty="Country_ID">
<Fields>
<ext:RecordField Name="Country_ID" />
<ext:RecordField Name="Country_Name_En" />
<ext:RecordField Name="Country_Name" />
<ext:RecordField Name="Country_Name_Ar" />
<ext:RecordField Name="Ordering" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Store ID="StoreUnits" runat="server">
<Reader>
<ext:JsonReader IDProperty="Unit_ID">
<Fields>
<ext:RecordField Name="Unit_ID" />
<ext:RecordField Name="Unit_En" />
<ext:RecordField Name="Unit_Ar" />
<ext:RecordField Name="Unit" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Viewport ID="Viewport1" runat="server" Layout="border">
<Items>
<ext:Window ID="wdwAddStudents" runat="server" Hidden="false" Collapsible="false"
Header="false" Height="305" Icon="ChartOrganisation" Title="Add Student"
Layout="FitLayout" PreventBodyReset="true" Width="590" Maximizable="false" AutoScroll="true" AutoDestroy="true"
ButtonAlign="Center" Region="Center" Closable="false">
<Items>
<ext:FormPanel ID="FormPanel2" LabelWidth="150" AutoScroll="true" runat="server"
ButtonAlign="Center" Frame="true" Layout="Form" Padding="5" >
<Items>
<ext:NumberField ID="nbfStudent_ID" DataIndex="Student_ID" MaxLength="9" FieldLabel="Student_ID"
runat="server" AllowBlank="false" Width="150" AnchorHorizontal="25%">
</ext:NumberField>
<ext:CompositeField ID="cpfNameArabic" runat="server" NoteAlign="Top" AutoScroll="true"
LabelAlign="Left" FieldLabel="<%$ Resources:ParadigmMres, Name_Ar%>" AnchorHorizontal="60%">
<Items>
<ext:TextField ID="txfStudent_Name_Ar_3" DataIndex="Student_Name_Ar_3" Flex="1"
runat="server" AllowBlank="false">
</ext:TextField>
<ext:TextField ID="txfStudent_Name_Ar_2" DataIndex="Student_Name_Ar_2" Flex="1"
runat="server" AllowBlank="false">
</ext:TextField>
<ext:TextField ID="txfStudent_Name_Ar_1" DataIndex="Student_Name_Ar_1" Flex="1"
runat="server" AllowBlank="false">
</ext:TextField>
</Items>
</ext:CompositeField>
<ext:TextField ID="txfProfession_Ar" runat="server" FieldLabel="Profession (Ar)"
AllowBlank="false" AnchorHorizontal="45%">
</ext:TextField>
<ext:ComboBox ID="cbxNationality_ID" DataIndex="Nationality_ID" FieldLabel="Nationality"
runat="server" AnchorHorizontal="35%" StoreID="StoreCountry" ValueField="Country_ID"
DisplayField="Country_Name" AllowBlank="false" Editable="false">
<SelectedItem Value="213" />
</ext:ComboBox>
<ext:CompositeField ID="cpfNameEnglish" runat="server" NoteAlign="Top" AutoScroll="true"
AnchorHorizontal="60%" LabelAlign="Left" FieldLabel="<%$ Resources:ParadigmMres, Name_En%>">
<Items>
<ext:TextField ID="txfStudent_Name_En_1" DataIndex="Student_Name_En_1" Flex="1"
runat="server" AllowBlank="true">
</ext:TextField>
<ext:TextField ID="txfStudent_Name_En_2" DataIndex="Student_Name_En_2" Flex="1"
runat="server" AllowBlank="true">
</ext:TextField>
<ext:TextField ID="txfStudent_Name_En_3" DataIndex="Student_Name_En_3" Flex="1"
runat="server" AllowBlank="true">
</ext:TextField>
</Items>
</ext:CompositeField>
<ext:TextField ID="txfProfession_En" runat="server" FieldLabel="Profession (En)%>"
AllowBlank="true" AnchorHorizontal="40%">
</ext:TextField>
<ext:ComboBox ID="cbxUnit_ID" DataIndex="Unit_ID" FieldLabel="Unit"
runat="server" AnchorHorizontal="35%" StoreID="StoreUnits" ValueField="Unit_ID" Editable="false"
DisplayField="Unit" AllowBlank="false" >
</ext:ComboBox>
</Items>
<Buttons>
<ext:Button runat="server" ID="Button2" Icon="Disk" Text="Save">
<DirectEvents>
<Click Before="return #{FormPanel2}.getForm().isValid();" OnEvent="saveStudent" >
<ExtraParams>
<ext:Parameter Mode="Raw" Name="FormValues" Value="Ext.encode(#{FormPanel2}.getForm().getValues())" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
</Items>
</ext:Viewport>
</form>
</body>
</html>
the code for save form :protected void saveStudent(object sender, DirectEventArgs e)
{
//used for confirmation when clicking on "Yes" button the directMethod DoYes() is fired
UtilityHelper.ConfirmDisplayMsg(ParadigmMres.msgConfirmTitle, ParadigmMres.msgConfimStudentAdd);
//Public static string
formValues = e.ExtraParams["FormValues"];
}
[DirectMethod]
public void DoYes()
{
string student_ID = nbfStudent_ID.Text;
string nationality_ID = cbxNationality_ID.SelectedItem.Value;
// After succesful retrieving we will update DB and reset the formPanel
}
[DirectMethod]
public void DoNo()
{
}
All the fields values from the formPanel are null. (but without ConfirmMessage It's ok).Di you have any suggestions to retrieve fields values ?
Last edited by Daniil; May 10, 2012 at 8:24 AM.
Reason: [CLOSED]