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

Question

Question

Auto populate a row field with the row number?

asked on August 5, 2014

 

 

I attended a Consultation Forum Webinar today and worked with Zachary.  Over all the meeting was great but now I am unable to make any of the things we discussed work.  
I would like to have JavaScript populate a column with the row number so that I can capture that number for a look up into SQL.  Zachary provided a some script but did warn me that it was rough.  The only problem is I am unable to get it to work at all.  Please help.

function rowNumbering() {
    currentRow = 1;
    $('.cf-table-block tbody tr').each(function () {
        $(this).find('.rowNum input').val(currentRow);
        currentRow++;
    });
}

Once I can populate the numbers I will attempt to apply this article from answers  https://answers.laserfiche.com//questions/48879/Auto-Fill-Button.

First hurdle is populating the row number in the table.

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on August 5, 2014 Show version history

Looks like there are a few things going on here. First, you'll add the rowNum class to the field in your table where you want the row number to go.

 

Then, you can add this code to your CSS and JavaScript page. Replace #q2 with the identifier for your table's Add button.

 

$(document).ready(function () {

    $(document).on('click', '.form-del-field', function () {
        rowNumbering();
    });

    rowNumbering();
    $('#q2').click(rowNumbering);

    function rowNumbering() {
        currentRow = 1;
        $('.cf-table-block tbody tr').each(function () {
            $(this).find('.rowNum input').val(currentRow);
            currentRow++;
        });
    }
});

 

1 0
replied on May 18, 2017 Show version history

I tried implementing this as shown below. It works great in "Preview" however it does not work when filling in a new form for submission. The first person to solve this get a "You Rock!!!" award.

 

Below are screenshots of the "Preview" and the Form Submission panels.

Submission 

0 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.