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

Question

Question

How to use Java/CSS to hide rows in a table if they are checked in a previous form of a business process.

asked on May 3, 2017 Show version history

I have a form that populates a table with a user's current security access.  The table has a column that allows the user to check a checkbox to "remove" an access that a user currently has.  This form can be quite long - so we are trying to hide the current access that hasn't been checked for removal in the table when saving it to the repository.  I have tried several things (suggested here and elsewhere) and am not very familiar with Javascript or CSS - so any input would be greatly appreciated!

I attached screenshots of what I have tried - thanks in advance for your help!

Michelle

CSS right now only class is access_table

Value of checked checkbox is "Remove"

 

0 0

Answer

SELECTED ANSWER
replied on May 19, 2017

Gave up for a little while and worked on other issues cool Grabbed a coworker when he needed a break from his challenges and look what he did...

$(document).ready(function() {
    $('.checkboxcss tbody tr').each(function () {
      if ($(this).find('.removeboxcss input').prop('checked') == true){
     $(this).show();
       } 
   else {
      $(this).hide();
    }
  });
});


Perfect!  Thanks for all the help - @████████

 

0 0

Replies

replied on May 3, 2017

0 0
replied on May 5, 2017

//will be triggered when click the checkbox
$(document).on('click','.checkboxcss input',hideCheckedRow);

//will be triggered when load the form
$(document).ready(hideCheckedRow);

 function hideCheckedRow(){
 $(".checkboxcss input:checked").each(function(){
    if($(this).val()=="Remove"){
      $(this).closest("tr").hide();
    }
    });
}

Try the above JavaScript, you need to add "checkboxcss" for the checkbox in the CSS class

0 0
replied on May 5, 2017

I already have checkbox as a css class for a different section in the form and I am using it to display the section in a certain format - does it have to be checkbox? or can I use another word to designate that section?

0 0
replied on May 5, 2017

I added checkboxcss to the checkbox column in the table - did not work.  So I then added checkboxcss to the table as well - still did not work.

0 0
replied on May 5, 2017

So, I'm looking at the code and want to give you a bit more background.  The submitter fills out the request form, then after the supervisor approves it - the form's information is moved to another form (IT Step) so additions/removal of checks can happen here as well as the form may have to go to another level of approval (SME Step) where additions/removals of checks can happen.  After the form is approved in either the IT Step or the SME Step - the final form (Repository Save) is loaded for the purpose of having the last form, cleaned, to be saved to the Repository.  I am only putting the code on the Repository form - as I need the ability to see all the rows in the table in the other steps - could this be the reason that the code is not working?

Sorry for the long post! :)

Michelle

0 0
replied on May 5, 2017

Also - :)  I want the checked boxes to SHOW - and all others to be HIDDEN

0 0
replied on May 7, 2017 Show version history

If you want the row that with the checkbox not checked to be hidden, you can just modify your script to following:


//will be triggered when load the form
$(document).ready(hideUncheckedRow);

 function hideUncheckedRow(){
   $(".checkboxcss :checkbox:not(:checked)").each(function(){
      $(this).closest("tr").hide();
    });
}

It works well for me, see https://www.screencast.com/t/gD2GBFCTjyF

0 0
replied on May 8, 2017

I'm wondering if the problem is that the "check" is happening 2 forms before this one... because it isn't working - or I am missing something - here's a recording of the form and the CSS info/Java in the form.  Thanks again for all your help!

Michelle

https://www.screencast.com/t/tNYQoxWz8Op

 

0 0
replied on May 8, 2017

So the Agresso Access Request- Rep form is used in the Save to repository service task? Can you show the configuration for it? For testing purpose, please use this form in a user task as parallel of the save to repository service task and set "Make form read-only for users the task is assigned to" and test whether the checkbox can be correctly removed when load the read-only form in the user task.

0 0
replied on May 9, 2017

Made changes as you suggested and took screen shots of the settings/results

Save to repository AAF - checkbox issue.png
Save to repository AAF - checkbox issue (2).png
Save to repository AAF - checkbox issue (3).png
0 0
replied on May 10, 2017

It seems the script doesn't run at all for your process. You can open the task using Chrome and click inspect to open the Developer tool and check whether there is any error in the Console tab. If there is no error, then you can debug as I demonstrated here to check whether the JavaScript is executed when load the form.  And you also can just test the JavaScript with a simple form that only have the table and only have that piece of JavaScript.

0 0
replied on May 16, 2017 Show version history

So - I think I found the issue with this - the form being used to save to the repository wasn't a form that was being used in any step - so I changed to the forms being used in the step before moving to the repository and it HID all the checked fields - I thought someone had responded here to show me the opposite code - but I don't see it.  I need to only see the checked boxes. I tried .show and this


//will be triggered when click the checkbox
$(document).on('click','.checkboxcss input',hideUncheckedRow);

//will be triggered when load the form
$(document).ready(hideUncheckedRow);

 function hideUncheckedRow(){
 $(".checkboxcss input:checked").each(function(){
    if($(this).val()=="Remove"){
      $(this).closest("tr").show();
    }
    });
}

 

neither worked - I was so excited...frown

1 0
SELECTED ANSWER
replied on May 19, 2017

Gave up for a little while and worked on other issues cool Grabbed a coworker when he needed a break from his challenges and look what he did...

$(document).ready(function() {
    $('.checkboxcss tbody tr').each(function () {
      if ($(this).find('.removeboxcss input').prop('checked') == true){
     $(this).show();
       } 
   else {
      $(this).hide();
    }
  });
});


Perfect!  Thanks for all the help - @████████

 

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

Sign in to reply to this post.