Forums

Read only Fields

Dhananjay 27 Aug, 2013
Hi Bob
I am using below code for read only fields in Load JS action
window.addEvent('domready', function() {
  var text_inputs, classes, cl, attr, el;
  text_inputs = $$('.cfdiv_text input');
  text_inputs.each(function(el){
    classes = el.getProperty('class');
    classes = classes.split(' ');
    classes.each(function(cl, index){
      cl = cl.trim();
      if ( cl.contains('[') ) {
        var attr = cl.replace(/[\[\]]/g, '');
        attr = attr.split('=');
        attr[1] = attr[1].replace('+', ' ');
        el.setProperty(attr[0], attr[1]);
        classes[index] = '';
      }
    });
    classes = classes.join(' ');
    el.setProperty('class', classes);
  });
});


and [readonly=readonly] in field class of all the text box in my form

but to my surprise it works only for first 3 text box and not all.
please see the image attachment

I hope my problem is clear

thanks
Dhananjay
GreyHead 01 Sep, 2013
Hi Dhananjay,

Are you using the old MonkeyPhysics DatePicker? I think that replaces the form inputs with ones that it creates - that would explain the problem. Please post a link to the form so I can take a quick look.

Bob
This topic is locked and no more replies can be posted.