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

Question

Question

Select first field in newly added row automatically?

asked on July 15, 2024

Is there a way to automatically select the first field in a new row after adding a new row?  A user has inquired since they usually tab to the "Add" button, click "enter" to add a new row, the new row is inserted, but the "Add" button is still selected, so the user needs to select with the mouse the first field in the new row in order to enter data in that newly created row.

 

Just wanted to see if there was a way to have the form function that way for ease of data entry.

0 0

Replies

replied on July 15, 2024

Which designer are you using? This can only be implemented on the classic designer right now.

 Generally speaking the simplest way to handle data entry from the user's perspective is to add all of the rows they need first and then mouse navigate to the first row and use tab entry to fill the data within the table.

Auto-focusing the last row of the table is great for row by row data entry but constrains how the table can be used. It is also generally avoided for accessibility purposes, but if these are internal users and a known group it is ok to make a change like this.

0 0
replied on July 15, 2024

This particular form was built with the classic designer.

0 0
replied on July 16, 2024 Show version history

This code will work for any table with the class "my-table". It also assumes the first column of your table is an html input field. Let me know how it works out!

 

const dataEntryTable = $('.my-table');
const dataEntryAddRow = dataEntryTable.find('.cf-table-add-row');

dataEntryAddRow.click(function (ev) {
  const activeTable = $(ev.target).closest('.my-table');
  const lastRow = activeTable.find('tr:last');
  const firstColOfLastRow = lastRow.find('td:first input');
  firstColOfLastRow.focus();
});

 

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

Sign in to reply to this post.