0 Replies Latest reply on Oct 24, 2012 2:58 PM by renke

    Disable input via jQuery

    renke Newbie

      Hi all

       

      I'm trying to make a input text disable status dynamic, through jQuery (not using reRender because of the performance). But this one seems to be a little bit trickier than it appears to be.

       

      So, I have a javascript function, wich is responsible for updating the value and other statuses for a bunch of h:inputText. No problem updating their values, but when it comes to updating the disable status strange things happen. I cannot actually disable a field, even trying all the options below:

       

       

      jQuery(document.getElementById('fieldID')).attr('disabled', 'disabled');
      
      jQuery(document.getElementById('fieldID')).attr('disabled', true);
      
      jQuery(document.getElementById('fieldID')).attr('disabled', 'true');
      
      // or even non jQuery alternatives
      document.getElementById('fieldID').disabled = 'disabled';
      
      document.getElementById('fieldID').disabled = true;
      

       

      Also, calling any of the options above on a field already disabled will automatically enable it, because the updated html will be <input disabled="">

       

      I've already tested this with JSF 1.2 and with jQuery 1.3.2, the version on my implementation of richfaces, and with 1.8.2, the most recent

       

      Someone knows what I'm missing? I'm already feeling kinda dumb for asking a question that simple