Announcement Announcement Module
Collapse
No announcement yet.
Dynamic Disabling of Fields Not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Disabling of Fields Not working

    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>
    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 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.
Working...
X