Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to clear the contents of a row

_jadobe_
Level 2
Level 2
Hi Friends,

I have a table with around 10 rows and those rows have different fields.

when the user clicks the "Delete" button, the users should be able to delete the field values of that row..

Is there any easy way to achieve this, like deleting the whole row contents in once, instead of going into each field to deleting the contents..



Thanks

JJ
10 Replies
pguerett
Level 10
Level 10
Are you trying to simply clear the fields in the row or delete the entire row (i.e if I have 10 rows and I delete a row I now have 9)?
_jadobe_
Level 2
Level 2
Hi Paul,

Thanks again for trying to help me.

I wish to clear the fields in the row and once deleted there will be only 9 rows ( basically i will be hiding the deleted row once after clearing the field contents).



Thanks

JJ
pguerett
Level 10
Level 10
Then simply remove the instance of the row and all data will disappear with it. You can use a removeInstance(instance Number) to accomplish this.
_jadobe_
Level 2
Level 2
Hi Paul,

Do you have a sample code to share with me..

My code did not worked..



Thanks
pguerett
Level 10
Level 10
subformName.instanceManager.removeInstance(instance number to remove)



Note the instances are 0 based.
_jadobe_
Level 2
Level 2
Hi Paul,

my subforms are too deep from form like..

form1.subform1.subform2.subform3 and the delete button is in subform2 and i wish to remove the contents of subform3..



if that is the case how the code will look like..



Thanks

JJ
pguerett
Level 10
Level 10
So if you use:



form1.subform1.subform2.subform3.instanceManager.removeInstance(instance number).
_jadobe_
Level 2
Level 2
Hi Paul,

Sorry to say that, i am not using instance manager to create subfroms, the about code only removes that instance.



I have each 10 subforms inbuilt, i mean to say only one will be visible at a time and needs a script to remove the contents.



I found that xfa.host.resetData(fieldnames)can achieve this but still

looking for a script to get all the field names of the subform.



if you have any script which gets all the field names in a subform please share with me.



Thanks

JJ
Aditya_S_
Level 7
Level 7
Paul - On a similar note, I have a static table with 11 rows and I would like to remove form1.Table1.Row3



What will be the syntax ? I tried using




form1.Table1.instaceManager.removeInstance(form1.Table1.Row3);



but it didn't work



Any suggestions ?



Aditya
pguerett
Level 10
Level 10
form1.Table1.Row3.removeInstance(instanceNumber)