Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-2807

Dynamic Disabling of input fields fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.4.RELEASE
    • Fix Version/s: 1.2.0.RC1
    • Component/s: WEB MVC
    • Labels:
    • Environment:
      STS , Tomcat 6.0

      Description

      Hi , I have to implement a functionality wherein my input type="text" should get disabled depending whether the checkbox was clicked or not. Im using ROO 1.1.4 and the ROO Generated Tags STS and Tomcat 6.0

      Here is the code.

      [CODE]
      <field:checkbox field="one" id="one" disableFormBinding="true"></field:checkbox>
      <field:input field="level" id="level" min="1" required="true" z="04Zv12YwlSDiwT5c7Br131vGspE="/>

      <script type="text/javascript">
      dojo.addOnLoad(function(){
      dojo.parser.parse();
      var event="onClick" ;
      var eventHandler="testCheckBox";
      var sourceWidget=dijit.byId("_"one"_id"); // Roo Tags generate the id internally as '_one_id'
      var target="level";
      dojo.connect(sourceWidget,event,dojo.partial(eventHandler,target,source));

      function testCheckBox(target,source,value){

      var targetWidget=dijit.byId("_"target"_id");
      var sourceWidget=dijit.byId("_"source"_id");

      if(sourceWidget.checked==true)

      { targetWidget.attr("disabled",""); }

      else

      { targetWidget.attr("disabled","disabled"); }

      }

      });
      </script>

      [/CODE]

      Now Everything here works fine , just the way it is intended to work.
      i.e. When i check the checkbox , the text box is enabled and when i uncheck it , it gets disabled.
      But the issue occurs , when i a disable it once and then after re-enabling it , i am unable to enter any value in the textbox :mad: I have been trying to figure out for 2 days what exactly is going wrong !! Its really driving me crazy.
      You can run and check the above code and test it on the environments i have specified.

      Also this issue occurs with FilteringSelect also.
      instead of inputBox if i keep a Select Box like the one below ,

      <field:select field="books" id="books" itemValue="id" items="${books}" path="/books" z="user-managed"/>

      With target specified as target="books" , then after disabling it , and then re-enabling it , i am unable to type in the Filtering Select, The Select functionality works fine , but i cannot input any data to perform the filtering action.

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            salecharohit Rohit
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2d
                2d
                Remaining:
                Remaining Estimate - 2d
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified