Ignore:
Timestamp:
07/05/05 15:59:21 (14 years ago)
Author:
gocher
Message:

Workaround for removeAttribute() and setAttribute()
problems with IE

for Example
object.setAttribute("readOnly",true) in IE
object.setAttribute("readOnly","readOnly") in Mozilla

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/Forms/popups/input.html

    r239 r254  
    2222    case "text": 
    2323    case "password": 
    24       fields = ["f_name", "f_value", "f_readonly", "f_disabled", "f_tabindex", "f_accesskey", "f_size"]; 
     24      fields = ["f_name", "f_value", "f_readOnly", "f_disabled", "f_tabindex", "f_accesskey", "f_size", "f_maxLength"]; 
    2525      height = 350; 
    2626      document.getElementById("txt").style.display = "block"; 
     
    6363  for (var i in fields) { 
    6464    switch (fields[i]) {  
    65     case "f_readonly":  
     65    case "f_readOnly":  
    6666    case "f_disabled": 
    6767    case "f_checked": 
    68       document.getElementById(fields[i]).checked = param[fields[i]]=="true"; break; 
     68      document.getElementById(fields[i]).checked = (param[fields[i]]==fields[i].substring(2,20)) || (param[fields[i]] == true); break; 
    6969    default: 
    7070      document.getElementById(fields[i]).value = param[fields[i]]; break; 
     
    8484  // pass data back to the calling window 
    8585  var param = new Object(); 
    86   param["f_type"] = type; 
    8786  for (var i in fields) { 
    8887    switch (fields[i]) { 
    89     case "f_readonly": 
     88    case "f_readOnly": 
    9089    case "f_disabled": 
    9190    case "f_checked": 
    92       param[fields[i]] = (document.getElementById(fields[i]).checked)?"true":""; break; 
     91      if(HTMLArea.is_ie) 
     92        param[fields[i]] = (document.getElementById(fields[i]).checked)?true:""; 
     93      else 
     94        param[fields[i]] = (document.getElementById(fields[i]).checked)?fields[i].substring(2,20):""; 
     95      break; 
    9396    default: 
    9497      param[fields[i]] = document.getElementById(fields[i]).value; break; 
     
    149152  <div id="txt"> 
    150153    <div class="fr">Read Only</div> 
    151     <input type="checkbox" name="readonly" id="f_readonly" value="readonly" /> 
     154    <input type="checkbox" name="readOnly" id="f_readOnly" value="readOnly" /> 
    152155    <p /> 
    153156     
     
    159162      <div class="space"></div> 
    160163      <div class="fr">Max length:</div> 
    161       <input type="text" name="maxlength" id="f_maxlength" size="5"     title="Maximum number of characters accepted" /> 
     164      <input type="text" name="maxLength" id="f_maxLength" size="5"     title="Maximum number of characters accepted" /> 
    162165      <div class="space"></div> 
    163166          </fieldset> 
Note: See TracChangeset for help on using the changeset viewer.