I've built a form that has a few tables (all in flowed subforms) that each have an action to add a new instance of the row if the last cell is not empty. I've done this before in other forms and had no issues, but for some reason in this form when I tab out of the cell and it adds a new row, it puts the cursor in the next field after the table, skipping the new row. My tab order is set to automatic, so I have no idea why it's not tabbing into the new row.
I found some discussions about this happening in Designer 8, but they were solved by using flowed subforms and ensuring the overall subform is flowed (check!) or automatic tab order (check!).
Any help would be appreciated!!
Personally I don't really like the way it's behaving, but if this is what you really want. You can use the following code for the exit event of the last field in the row...
Otherwise, if you don't like it, I suggest you to have a subform/cell within the table with a (+ / -) button to add / remove rows
This is more user friendly
*This code is totally modifiable if the behaviour is not to your liking. But I did my best to make it work the best way possible.*
Make sure you have the script editor open in LiveCycle, to enter this code in the event "change" of each last fields of a row.
You don't need to change anything from one field to another, you just need to put the code in the event "change"
Here is the code :
If you want to keep this in your files for upcoming forms, here is a (*.txt) file available to download and keep it available at any time.
P.S. : This code will not work IF the textfield you put the code in is inside a subform. Keep in mind the textfield must be considered as a cell in a table's row!!
I hope this will help you throughout your forms.
I'd say it behaves this way because of the order in which the code is executed. Which means when you tab out of the last field, the tab out is executed before adding the new instance..
I don't know what event you are using to add the new instance and from which object you are executing the event.
If you could explain more in details what steps you are doing (events, object_event, code), it would be more convenient to help you debug this issue.
I was using buttons before, but the users didn't like the look of having the buttons on the form. Personally I like it better that way too.
Thank-you SO SO much for all your help; you're fantastic!
Yes, that's exactly what I'm looking for. The code you sent works perfectly for adding rows, so I need another action to remove extra rows.
Do you mean, removing the instance if it is empty on the exit event instead of empty on the change event?
This is awesome!!
Could you add some code to remove the last instance of Row1 if it is empty/not changed? If we can do that, it will be perfect and I will use this code in a whole bunch of forms (hurray!!!).
PS - do you have any recommendations on a good online coding tutorial? I think it would help me solve a lot of minor issues.
Yes, I am using ES4; if you could send me the code (and tell me where to put it) that would be amazing!!
I tried setting the action to 'when 'fieldname' is changed...' but it added a new row for every character I typed in the field. Honestly, I have no idea why it works in one form (users have no issues with it, and I know they're not using the current version of Reader) and not the other, or why it doesn't work for you in either form.
And also, thank-you thank-you thank-you!!!
Well first of all, I am surprised that one of your form works when tabbing out of the last field of a row.
When I test your forms(both), it is not entering the first field of the new instance when tabbing out of the last field of the previous row. (I am using ES2 and Reader / Acrobat 10) I don't know if it behaves differently with ES4 or latest version of Reader.
When looking at the code in the events, both forms has the same script and the events used to do so are not the good ones.
As I said on my first reply,
Instead of executing the code in the exit event of your field, you would need to execute it when changing the value of the field(before being done entering information in the last field)
If you are using LiveCycle ES4, I could provide you with the code to get this done. And honestly I don't know how it could work in your form "Emerald Bay" by looking at the code generated by the Action Builder. It's definitely missing some code.
I'm very sorry, I understand now why I could not open your PDF form, I will come back as soon as I can with a brief solution if I find any...
I'm wondering if it was a problem with the link actually, since I ended up having a 2 hour call with IT yesterday to try and make my computer work...
Try these links:
Form where the actions/tab order works fine: Dropbox - FRM-AB-003-W-WW-Ops Summary Emerald Bay.pdf
Form where the same thing doesn't work, and I'm probably missing something basic: Dropbox - FRM-AB-005-W-WW-Monthly Operations Report.pdf
maybe restarting the form from blank would be a great idea, even Adobe Reader can't open your PDF...
hmmm...sorry my file didn't work.
I've used this same action in other forms and it automatically changed the tab order correctly when adding the new row, so I know it works, I just don't know what's wrong with this particular form.
Thanks for trying!!
Unfortunately, I was unable to open your form, it seems it is not a PDF format file when opening with LiveCycle
I tried in LiveCycle to reproduce what you are trying to do with the action builder, and to my knowledge it is impossible to do it with the action builder.
It would be possible making your own script, but the action builder is missing some options to make it work. The only option missing is to check if you are on the last instance of the rows in the table.
Sorry I could not help you.
Thanks for responding!
The action is as follows (in the 'action builder'):
Condition: When text field "fieldname" is not empty
Result: Add a new instance of "Row1"
The result is dependent on exiting the condition field.
Does that help? I'm not knowledgable in coding...
Here is my form, so you can see what I'm working with: https://www.dropbox.com/l/s/P7JROAecSqDc9fqhYnrslp