Problems with checkboxes with readOnly set to true

Questions, tips and tricks and techniques for scripting in Servoy

Problems with checkboxes with readOnly set to true

Postby paulc » Tue Jul 27, 2010 10:56 pm

Hi, I am having an issue with the checkboxes on my forms, we are currently moving from 4.1.7 to 5.1.4. We did not experience this problem in 4.1.7. On load/show the checkboxes readOnly properties are set to true. When the user clicks a button to enable "edit" I have to set all fields on my form to readOnly = false. The following code works for all other elements on my form, but the checkboxes are never able to set the readOnly = false unless I set the field properties through a qualifid name.

Has anyone experienced this? Is there a better way to do this?

what I do is:

Code: Select all
for(i in elements.allnames)
  {
    var elementName = elements.allnames[i];
   
    var args = elementName.split('_');
    if(args[0] == 'fld')
    {
      elements[elementName].readOnly = !lv_find_mode;
      elements[elementName].enabled  = lv_find_mode;
      if (elements[elementName].getElementType() != 'CHECK')
        elements[elementName].editable = lv_find_mode;
    }
  } 

//added to fix checkbox readonly issue
  elements.fld_fv_active_ind.readOnly = !lv_find_mode;
  elements.fld_fv_current_seis_status.readOnly = !lv_find_mode;
  elements.fld_fv_dimension.readOnly = !lv_find_mode;
  elements.fld_fv_dirty.readOnly = !lv_find_mode;
  elements.fld_fv_k_original_owner.readOnly = !lv_find_mode;
  elements.fld_fv_k_ownership_class.readOnly = !lv_find_mode;



Thanks
paulc
 
Posts: 55
Joined: Wed Feb 17, 2010 8:58 pm

Re: Problems with checkboxes with readOnly set to true

Postby ptalbot » Tue Jul 27, 2010 11:12 pm

What we tend to do is put all the fields we want to enable/disable etc. in a form, then put this form in a tabPanel.

Now when we want to change the state of all this field, we simply set the tabPanel enabled or readOnly to the state we want.
You can also set the form's controller enabled or readOnly property.

We found it a lot shorter than iterating through all the fields, just put all the buttons that are supposed to toggle the state of the tabPanel/form, out of it in the parent form.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Problems with checkboxes with readOnly set to true

Postby jcompagner » Wed Jul 28, 2010 10:38 am

what happens if you do this:

Code: Select all
      elements[elementName].readOnly = !lv_find_mode;
      if (elements[elementName].getElementType() != 'CHECK')
      {
        elements[elementName].enabled  = lv_find_mode;
        elements[elementName].editable = lv_find_mode;
      }


setting readOnly is the same as enabled for a checkbox...
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Methods

Who is online

Users browsing this forum: No registered users and 12 guests