Jul 30, 2010, 8:53 PM
[CLOSED] How to find if dynamically added form input values have changed (v0.8 )
I have a FormPanel that I am adding items to in code-behind when the page is loaded:
I tried putting in a javascirpt save function that is called as a Fn when a button is clicked, but it always returns true for isDirty even when nothing has been changed.
<ext:Tab
ID="TabCustomFields"
runat="server"
Title="Custom Fields" StyleSpec="padding:10px;" Visible="false" AutoScroll="true" Width="400">
<Body>
<ext:ColumnLayout ID="ColumnLayout7" runat="server" >
<ext:LayoutColumn ColumnWidth="0.5">
<ext:FormPanel ID="FormPanelCustomFieldLeft" runat="server" Header="false" Frame="false" Border="false">
<Body>
<ext:FormLayout ID="FormLayoutCustomFieldLeft" runat="server" LabelAlign="Left" LabelWidth="75" LabelSeparator=":">
<ext:Anchor Horizontal="100%">
<ext:Hidden runat="server" ID="HiddenCustomFieldIDs"></ext:Hidden>
</ext:Anchor>
<ext:Anchor Horizontal="100%">
<ext:Hidden runat="server" ID="HiddenCustomFieldNames"></ext:Hidden>
</ext:Anchor>
<ext:Anchor Horizontal="100%">
<ext:Hidden runat="server" ID="HiddenCustomFieldDataTypes"></ext:Hidden>
</ext:Anchor>
<ext:Anchor Horizontal="100%">
<ext:Hidden runat="server" ID="HiddenCustomFieldInputTypes"></ext:Hidden>
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:FormPanel>
</ext:LayoutColumn>
</ext:ColumnLayout>
</Body>
</ext:Tab>
'create a text box control
txtTemp = New Coolite.Ext.Web.TextField
txtTemp.ID = CustomFieldFormID
txtTemp.MaxLength = MaxLength
txtTemp.Text = Null2String(Value)
txtTemp.FieldLabel = FieldName
tmpAnchor = New Anchor
tmpAnchor.Items.Add(txtTemp)
FormLayoutCustomFieldLeft.Anchors.Add(tmpAnchor)
I want to know if any values on the form have been updated so I only save the data if there is a change. I tried putting in a javascirpt save function that is called as a Fn when a button is clicked, but it always returns true for isDirty even when nothing has been changed.
var saveForm = function() {
alert(FormLayoutCustomFieldLeft.isDirty());
Coolite.AjaxMethods.Save();
};
Does adding the items dynamically cause the FormPanel to be set to IsDirty? Is there a way I can accomplish finding out if any form input has been changed?
Last edited by Daniil; Aug 02, 2010 at 12:38 PM.