Feb 09, 2010, 8:40 AM
[CLOSED] Multifield + Visiblity
Hi,
I've got a form with a multifield that is dependent on the selected value of a combobox.
When i select another value of my combobox, then some fields in the multifield may be visible and other fields not. The first time, when loading, everything goes well, but when changing the selected combobox value, then i go in my ajaxmethod and change a field of the multifield to 'visible=false', but on my screen it's not updated, the field is still visible.
example:
<ext:FormLayout ID="AddEditEDIBlockColumn" runat="server" Cls="formLayout">
<ext:Anchor Horizontal="90%">
<ext:TextField ID="txtColumnName" runat="server" FieldLabel="Column Name*"
AllowBlank="false" BlankText="Column Name is required." />
</ext:Anchor>
<ext:Anchor Horizontal="50%">
<ext:ComboBox id="cboColumnDataType" runat="server"
FieldLabel="Data Type*"
AllowBlank="false"
BlankText="Data type is required."
ValueNotFoundText="Loading..."
>
<Items>
<ext:ListItem Value="BIT" Text="BIT" />
<ext:ListItem Value="DATETIME" Text="DATETIME" />
<ext:ListItem Value="NUMERIC" Text="NUMERIC" />
<ext:ListItem Value="VARCHAR" Text="TEXT" />
</Items>
<Listeners>
<Select Handler="Coolite.AjaxMethods.DataType_Changed();" />
</Listeners>
</ext:ComboBox>
</ext:Anchor>
<ext:Anchor>
<ext:MultiField runat="server" FieldLabel="Size" ID="MultiFieldDataType">
<Fields>
<ext:TextField ID="txtColumnMaxLength" runat="server" Visible="true" />
<ext:ComboBox ID="cboColumnPrecision" runat="server" Visible="false" Width="40" />
<ext:ComboBox ID="cboColumnScale" runat="server" Visible="false" Width="40" />
</Fields>
</ext:MultiField>
</ext:Anchor>
<ext:Anchor Horizontal="90%">
<ext:TextField ID="txtColumnDefaultValue" runat="server" FieldLabel="Default Value" />
</ext:Anchor>
<ext:Anchor>
<ext:Checkbox ID="chkColumnIsNull" runat="server" FieldLabel="Allow Null" />
</ext:Anchor>
</ext:FormLayout>
<AjaxMethod()> _
Public Sub DataType_Changed()
Dim DataType As System.String
If Not (Utils.IsEmpty(Me.cboColumnDataType.SelectedItem.Value)) Then
DataType = Me.cboColumnDataType.SelectedItem.Value
Select Case DataType.ToUpper
Case "VARCHAR"
Me.txtColumnMaxLength.Visible = True
Me.cboColumnPrecision.Visible = False
Me.cboColumnScale.Visible = False
Case "NUMERIC"
Me.txtColumnMaxLength.Visible = False
Me.cboColumnPrecision.Visible = True
Me.cboColumnScale.Visible = True
Case Else ' DateTime or bit
Me.txtColumnMaxLength.Visible = False
Me.cboColumnPrecision.Visible = False
Me.cboColumnScale.Visible = False
End Select
End If
End Sub