Triggered transacting group

I have a a windows that product information is entered by operators. I have a transaction group for the tags in the window that is triggered by a submit button tied to a submit tag in this group.All fields must be populated to enable the submit button.I tried to add a script to the submit button that would clear the fields by placing " " in the string fields and 0 in the numeric fields when the button is pressed. My problem is that half of the time everything works perfectly, the tags are written to the database then the fields are cleared. Other times the fields are cleared before the transaction group is inserted into the database. Is there a way that i can ad a delay to the script clearing the fields to allow time for the transaction group to process? i have this broken into 2 separate buttons to work around this for the interim but would like to recombine these to limit the possibility of multiple submit entry’s.

if it will help this is the script used:

event.source.parent.parent.getComponent('ActionData').getComponent('drumPart').text= ""
event.source.parent.parent.getComponent('ActionData').getComponent('drumLot').text= ""
event.source.parent.parent.getComponent('ActionData').getComponent('gross').doubleValue=0
event.source.parent.parent.getComponent('ActionData').getComponent('backWt').doubleValue=0

Don’t use a transaction group for user-triggered database operations. Don’t even use tags for these fields. Use a named query that is fed the field contents directly, and close the window after the query runs.

I use this window in a project in project that is used on multiple machines using indirect tags. Is each window was in its own namespace.

Doesn't matter. You are asking for trouble. Don't use tags as temporary locations for user input.

Thank you, I will revise the window.

You can use an expression binding on the text fields with a constant empty string to clear them automatically every time the window opens. A constant binding only runs once, then the user can edit as normal. Your validation then only needs to check for non-empty strings.