Repeating table - auto-add next row

M

mikeram

I want to have a data collection form that is very simple and does not
require the user to click and select to add a new record to the repeating
table. Basically, when they enter data into the last field on row 1, it
would auto-add the next row below the first and be ready for them to enter
data in the first field on the new row. Is this possible? Could someone
much wiser point me in the right direction? Much appreciated!
 
G

Greg Collins [InfoPath MVP]

It can be done with code and a change event handler, however it is not as foolproof as you might think. How do you know whether the user finished a row, or just changed the value of that last field? If you think, "I'll just see if it was blank before and now isn't", that's not good enough--someone could delete the value, and then enter a new one. Then you'll have new rows popping up when they shouldn't be.

Now if you don't care about that scenario, then its doable, using code to inject the XML representing a new row into the DOM.
 
M

mikeram

Hm, I see your point. I think in my example, the frequency that the user
would correct the data would be minimal. I also intended to write SQL Server
code to take out the NULL entries as a catch all. But, I still do not want
users to become frustrated if they are creating 20 blank rows. However, this
is a barcode scanning application and I have to make it as quick and
keyboard-less as possible.

I assume you are talking about an OnAfterChange event and then inserting
some code to create the new row. I think I would also like the event to
change the value of a different field on the new row, and set the cursor into
the first field that the barcode scanner will read in.

I am wondering if there is an easier way, such as in MS Access or even MS
Word or MS Excel.

I think I am basically trying to setup a 1-2-3-2-3-2-3-...-Submit, type of
relationship. Basically, so that the user sets the value of the first field
(say a destination), then scans multiple item and serial numbers without
having to access the keyboard, then reviews and submits the data to SQL
Server by accessing the keyboard again.
 
G

Greg Collins [InfoPath MVP]

You can definitely do what you are talking about. Yes, the OnAfterChange event handler is what you need (sorry about being generic earlier, but IP2007 has renamed that event).

Basically, you would clone the existing row, clear the values (it sounds like you have one value that carries over so you wouldn't clear that value), insert the new row, and then set the insertion point.

All that is doable with code.

I don't know about the other applications, if they would be any easier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top