You are viewing limited content. For full access, please sign in.

Question

Question

empty passed on fields are read only

asked on March 23, 2017

When I pass on a table that progresses through a line of people for approval, I have made the previously entered info is read only.  This is great, except that I have a couple of fields that remain empty within the table that needs to be accessible if they are empty.

This chart has gone through the first person.  They selected the status of the items they are approving/rejecting.  The first four fields are prepopulated from another form, but require the Status field to be completed on this, and future versions. The last field is populated base on their current user.

The table is then passed on to the next user.  I wish to make the empty Status filed editable. I would like all Status fields that are empty to allow editing.  I have tried various ways to do this, but to no avail.  I think that the empty fields are considered as "previous data".  Is there a work around that can help me stipulate that empty status fields are not read only? Or, that filled Status fields are read-only?

 

0 0

Answer

SELECTED ANSWER
replied on March 24, 2017

You are right that empty values are also considered as "previous data" so the built in previous read only function does not work for you.

Instead you could try custom script like this (set 'Status' as CSS class on the drop down field):

$(document).ready(function(){
  $('.Status select').each(function(){
    if ($(this).val()) {
      $(this).attr('readonly',true);
      $(this).attr('disabled',true);
    }
  });
})

 

2 0
replied on April 11, 2017

I have now discovered that all items within the row containing a status should be read only, but not any other rows.

How do I amend the code to do this?  I managed to write code that made fields read only, but it is not specific to the particular row.

Here is what may code currently does...

I managed to create a secondary code based on the code in your response. It looks like this...

$(document).ready(function(){
  $('.codingStatus select').each(function(){
    if ($(this).val()) {
      $('.codingGL input').attr('readonly',true);
      $('.codingAmount input').attr('readonly',true);
      $('.codingDesc input').attr('readonly',true);
      $('.codingProject input').attr('readonly',true);
        }
  });
})

 

I'm not sure how to reference the specific fields.  any ideas?

0 0
replied on April 11, 2017

To find fields on the same row, you could use code like this:

  $('.Status select').each(function(){
    if ($(this).val()) {
      $(this).closest('tr').find('.codingGL input').attr('readonly',true);
    }
  });

 

1 0
replied on April 12, 2017

Thank you.  This one worked perfectly on the other fields.

0 0

Replies

replied on March 24, 2017

Thank you.  This worked!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.