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

Question

Question

Change range of rows dynamically

asked on February 17, 2017 Show version history

Hi all,

 

I have a form in which there is Laserfiche table that allows maximum of 10 rows. I have a span tag that says "Seats Left: 10". The number 10 is being pulled from the database so when users submit a form, the number of rows submitted is added to a database. Then when the form is refreshed the "Seats Left: 10" changes to  number of rows submitted minus 10.

 

Also, as you click to add rows, the number of seats decreases and as you remove rows the number of seats increases.

 

Let's say that the form is new so there are 10 seats. I go into the form and add 2 rows. The number of seats decreases to 8 for the viewer. I submit the form and when I come back the form says that there are 8 seats left. So far so good, but the issue is that I can still add 10 rows dynamically. Even if the seats left is just 8.

 

Do you know of a way to update dynamically the number of rows allowed in a table?

0 0

Answer

SELECTED ANSWER
replied on February 17, 2017 Show version history

eh! I went with hiding the "Add" link when the counter reaches zero.

 

Although I had came up with a different solution before, which was to actually use the "Append rows to the row populated by a data source or variable" choice from the Layout. Then I would hide them based on if the input field had already data in it. I'm posting it in case someone finds a better need for it.

 

  $( document ).ready(function() {

  setTimeout(checkRidVal, 1000);
  function checkRidVal () {

$('.name_of_class input').each(function() {
 
  
  		var name_of_class = $(this).val();
         if (name_of_class > '') {
           $(this).attr('readonly',true);
           $(this).attr('disabled',true);
           $(this).closest('tr').hide();
         }
  
  
          });

   }  

});

 

 

1 0

Replies

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

Sign in to reply to this post.