[CLOSED] TriggerField: Editable=false doesn't work

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] TriggerField: Editable=false doesn't work

    Hello,

    When I set Editable=false on a TriggerField, it remains editable...

                                                                        <ext:FieldContainer ID="RequestorInfo" runat="server" HideLabel="true" CombineErrors="false" MsgTarget="Under" LabelWidth="80" LabelStyle="font-weight:bold;" Layout="HBoxLayout">
                                                                            <Items> 
                                                                                <ext:TriggerField ID="lblRequestorName" AllowBlank="false" ReadOnly="false" runat="server" Note="Requestor" NoteAlign="Top" Flex="1" Editable="false">
                                                                                    <Listeners>
                                                                                        <TriggerClick Handler="#{RequestorName}.show();#{lblRequestorName}.hide(); #{RequestorName}.onTriggerClick() ;#{RequestorInfo}.doLayout();"></TriggerClick>
                                                                                    </Listeners>
                                                                                </ext:TriggerField>
                                                                                <ext:ComboBox ID="RequestorName" Disabled="true" runat="server" Flex="1" StoreID="storeUsers" AllowBlank="true" Editable="true" DisplayField="UserFullName" ValueField="GUID" TypeAhead="true" Mode="Local" ForceSelection="true" EmptyText="Select a Requestor..." Resizable="false" Note="Requestor" NoteAlign="Top" Hidden="true">
                                                                                    <Listeners>
                                                                                        <Select Handler="#{lblRequestorName}.show(); #{RequestorName}.hide(); #{lblRequestorName}.setValue(#{RequestorName}.lastSelectionText); #{txtInitialValueRequestorNameID}.setValue(#{RequestorName}.value);App.direct.SaveRequestorName({eventMask: {showMask: true, msg: 'Loading...'}}); #{RequestorInfo}.doLayout();" />
                                                                                        <Blur Handler="#{lblRequestorName}.show(); #{RequestorName}.hide(); #{RequestorInfo}.doLayout();" />
                                                                                    </Listeners>
                                                                                </ext:ComboBox>
                                                                            </Items>
                                                                        </ext:FieldContainer>
    Any idea?

    Kind regards,

    Reno
    Last edited by Daniil; May 30, 2013 at 4:14 AM. Reason: [CLOSED]
  2. #2
    Hello!

    Couldn't reproduce. Have tried the following example:

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        
    </head>
    <body>
         <ext:ResourceManager runat="server" ID="Resource1" Theme="Neptune" ScriptMode="Debug" SourceFormatting="True">
        </ext:ResourceManager>
     
     
        <form id="form1" runat="server">
            <ext:FormPanel runat="server">
                <Items>
                    <ext:FieldContainer ID="RequestorInfo" runat="server" HideLabel="true" CombineErrors="false" MsgTarget="Under" LabelWidth="80" LabelStyle="font-weight:bold;" Layout="HBoxLayout">
                        <Items> 
                            <ext:TriggerField ID="lblRequestorName" AllowBlank="false" ReadOnly="false" runat="server" Note="Requestor" NoteAlign="Top" Flex="1" Editable="false">
                                <Listeners>
                                </Listeners>
                            </ext:TriggerField>
                        </Items>
                    </ext:FieldContainer>
                </Items>
            </ext:FormPanel>
        </form>
    </body>
    </html>
    Can you provide your Ext.NET version?
  3. #3
    The version I'm using is: 2.2.0.40838 Ext.NET Pro via Nuget
  4. #4

    It is a bug!

    I've looked a little deeper in the code behind, and it seems that this field gets a property change via a DirectMethod.
    The property that gets changed is:
    lblRequestorName.ReadOnly = false;
    By doing so, the editable option is put back to true.
    I tried:
    lblRequestorName.ReadOnly = false;
    lblRequestorName.Editable = false;
    But that doesn't seem to help, the triggerfield remains editable...

    Can this bug be fixed, or is there another workaround?

    Kind regards,

    Reno
  5. #5
    We cannot reproduce the issue. We will happy to fix this if you provide a sample reproduces the issue
    Can you change Daulet example to demonstrate your issue?
  6. #6
    I cannot reproduce the issue either when I don't change the readonly property in code behind.
    But as soon as I change the readonly property in code behind to false, the triggerfield is editable again.

    IE: if you leave the triggerfield as is, with Editable=false, it works ok, but if you change the readonly to false via eg a DirectMethod, the 'non-editable' field is all of a sudden editable again...
    Last edited by reinout.mechant@imprss.be; May 26, 2013 at 7:52 PM.
  7. #7
    To me it seems that setting the ReadOnly property to false in code-behind, also changes the editable option...
  8. #8

    It is still a bug!

    Ok, I have used the sample from above, and implemented a DirectMethod (via a button) to set the triggerfield to readonly=false. And the same happens, the non-editable field all of a sudden becomes editable.

    here is the code:

    TriggerFieldTest.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TriggerFieldTest.aspx.cs" Inherits="AkzoNobel.DCE.Durability.BackOffice.TriggerFieldTest" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
      
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
         
    </head>
    <body>
         <ext:ResourceManager runat="server" ID="Resource1" Theme="Neptune" ScriptMode="Debug" SourceFormatting="True">
        </ext:ResourceManager>
      
      
        <form id="form1" runat="server">
            <ext:FormPanel ID="FormPanel1" runat="server">
                <Items>
                    <ext:FieldContainer ID="RequestorInfo" runat="server" HideLabel="true" CombineErrors="false" MsgTarget="Under" LabelWidth="80" LabelStyle="font-weight:bold;" Layout="HBoxLayout">
                        <Items> 
                            <ext:TriggerField ID="lblRequestorName" AllowBlank="false" ReadOnly="false" runat="server" Note="Requestor" NoteAlign="Top" Flex="1" Editable="false">
                                <Listeners>
                                </Listeners>
                            </ext:TriggerField>
                        </Items>
                    </ext:FieldContainer>
    				<ext:Button runat="server" Text="Set ReadOnly to false, even though it is false ;-)">
    					<Listeners>
    						<Click Handler="App.direct.SetReadOnly();"></Click>
    					</Listeners>
    				</ext:Button>
                </Items>
            </ext:FormPanel>
        </form>
    </body>
    </html>
    TriggerFieldTest.aspx.cs:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    
    namespace AkzoNobel.DCE.Durability.BackOffice
    {
    	public partial class TriggerFieldTest : System.Web.UI.Page
    	{
    		protected void Page_Load(object sender, EventArgs e)
    		{
    
    
    		}
    
    
    		[DirectMethod]
    		public void SetReadOnly()
    		{
    			lblRequestorName.ReadOnly = false;
    		}
    	}
    }
    Now that I have investigated it for you, please tell me how to fix/workaround this.

    Kind regards,

    Reno
  9. #9
    Editable=false and ReadOnly=true options set readonly attribute to input field
    When you set false to ReadOnly after field is rendered (in direct method) then you say 'remove readonly attribute from the input, field now can be changed by user'

    You should understand that default ReadOnly value is just default config value, setting value after rendering forces method calling (setReadOnly client side method). ReadOnly=false is transformed to App.Field1.setReadOnly(false), of course after that the field becomes editable

    So, it is not bug

    I don't see any sense to operate with Editable and ReadOnly for one field, you have to use ReadOnly OR Editable (not both at one time)
  10. #10
    Vladimir,

    I'm getting a little nervous now... I didn't invent that stupid idea that a TRIGGERFIELD uses 'readonly=true' to hide the trigger and 'editable=false' to disable the editing of a triggerfield!!!
    Only God knows why you did it like this, especially since the 'editable' setting doesn't even work on a regular Textfield...

    What do I need: a triggerfield that shows a value but remains uneditable, the triggeraction hides the triggerfield and shows a combobox on the same spot. When a value is selected from the combobox, the selected text of the selected item is placed in the triggerfield and the combobox hides and the triggerfield shows again.

    But, and here comes the reason why I do it like that, if the logged on user has a lower role, or it is not his record, he should not be able to change this field, hence the trigger needs to be gone.

    So I figured, when the user has no rights, the field is readonly=true and editable=false, and when the user has enough rights, the field is readonly=false and editable=false.

    This means, if your own rules are not workable for the triggerfield, what should I do?

    Kind regards,

    Reno
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] combobox editable=false without cursor
    By supera in forum 2.x Legacy Premium Help
    Replies: 11
    Last Post: Mar 06, 2014, 5:49 PM
  2. Replies: 6
    Last Post: Dec 19, 2012, 6:33 PM
  3. Replies: 3
    Last Post: Feb 22, 2012, 12:56 PM
  4. Replies: 2
    Last Post: Nov 09, 2011, 5:00 AM
  5. [CLOSED] [1.0] TriggerField with ReadOnly set does not work
    By jemmitch in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 25, 2009, 1:40 PM

Posting Permissions