[CLOSED] Disabled text fields

  1. #1

    [CLOSED] Disabled text fields

    Guys

    Having an issue which must have a simple solution but can't find it.

    So I have a field that toggles between disabled and enabled however I can't use Enable and Disable as the values do not get posted back to the server so the obvious solution is to use ReadOnly however what happens is this

    1. Form opens and ReadOnly set to true -- works.
    2. Form open again and ReadOnly set to false -- does not work as field is now permanently read only & css class remains as read only.

    Note the readonly set statements are called server side.

    Thanks,
    D
    Last edited by Daniil; Jan 29, 2014 at 10:59 AM. Reason: [CLOSED]
  2. #2
    Can you put this scenario together in a simplified .aspx code sample demonstrating the steps required to reproduce?
    Geoffrey McGill
    Founder
  3. #3
    Quote Originally Posted by geoffrey.mcgill View Post
    Can you put this scenario together in a simplified .aspx code sample demonstrating the steps required to reproduce?
    Hi Geoff

    It is very much embedded in an App and I am pretty tight on timeline but will try and put something together. For now though I have a work around by just reading the value client side and passing it into a DirectMethod and using that which works fine. I also prefer the field look and behaviour when using disabled versus readonly (even though I can probably reproduce the look using ReadOnlyCls -- just simpler using disabled & letting browser handle focus & appearance).

    For now though if you could just let me know if readonly can be reset server side.

    Thanks,
    D
  4. #4
    I'll run a few tests, but if you call .Render() on the TextField, it will force the client-side dom elements (input field) to re-render.
    Geoffrey McGill
    Founder
  5. #5
    Hi everybody,

    Setting ReadOnly on the fly should work. Here is my test case.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void SetTrue(object sender, DirectEventArgs e)
        {
            this.TextField1.ReadOnly = true;
        }
    
        protected void SetFalse(object sender, DirectEventArgs e)
        {
            this.TextField1.ReadOnly = false;
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TextField ID="TextField1" runat="server" />
    
            <ext:Button runat="server" Text="Set ReadOnly to true" OnDirectClick="SetTrue" />
    
            <ext:Button runat="server" Text="Set ReadOnly to false" OnDirectClick="SetFalse" />
        </form>
    </body>
    </html>
  6. #6
    Guys

    Danil beat me to the punch. I created a sample much like D's which worked, I then tried to match the failing structure as close as possible (panels, logic etc) which also worked. So I can't replicate it with a sample I am afraid. There is defo something affecting it though as triple checked the logic to make sure it is not a silly error like it getting reset -- also know this as simply using disabling instead of readonly has no problem. Not tested using render.

    Suggest close the call as I have a solution I am happy with, it clearly works and I can't replicate using a uploadable sample. If I get some more time will look into again.

    D
  7. #7
    Ok, no problem. Please feel free to post any new information in the thread even if it is [CLOSED].

Similar Threads

  1. v2.1.1 - FileUpload (bug?) and Disabled Fields
    By pcoimbrao in forum 2.x Help
    Replies: 2
    Last Post: May 22, 2013, 9:31 AM
  2. [CLOSED] Disabled fields don't get submitted
    By zwf in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 01, 2012, 11:47 AM
  3. Display problem with disabled fields
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 27, 2010, 6:14 PM
  4. Replies: 7
    Last Post: Aug 12, 2009, 4:04 PM
  5. Get value of disabled control
    By Kaido in forum Bugs
    Replies: 8
    Last Post: Mar 27, 2009, 3:53 AM

Posting Permissions