Expand my Community achievements bar.

Subform problem

Avatar

Level 4

Hi All

I have designed a form where you can add additional subforms by the click of a button.  What I want is for an object's presence on the initial subform to remain invisible all the time but all subsequent repeating subforms the object's presence to be visible.  Is this possible?

Thanks

Darren

6 Replies

Avatar

Former Community Member

I do not see why you cannot do this ....but I have to ask why? Why woudl you want to have an invisible first row? Why not start with 0 instances and then add them accordingly?

Paul

Avatar

Level 4

Hi Paul

It is not a row I want to be invisible it is a button which will delete additional subforms if one is added, hence why I don want to show on the 1st one.

Avatar

Former Community Member

Ok then that is much easier ......you can have the button invisible to start and when the user clicks the addInstance button you can check the count of sublforms with this command:

Repeating subform Name.instanceManager.count

If the count is greater than 1 then display the button if it is 1 then there is only one instance and you should make the button invisible again.

Paul

Avatar

Level 4

Hi Paul

I already did this but the problem was that it also displayed it in the

original subform. I would like the object presence to only display in

repeating instances and not the original subform.

Now I am thinking about it a bit more I think it would be sensible for me to

put the delete button outside of this repeating subform but then how would I

get it to display when there is a repeating instance of a subform and

disappear when there is only the original. Is there an event that would do

this?

Thanks

Darren

Avatar

Former Community Member

I woudl leave it in the repeating subform and on the initialize event of the button you could put code like this:

if (this.parent.index != 0){

     this.presence = "visible"

} else {

     this.presence = "invisible"

}

Paul

Avatar

Level 4

This brilliant Paul, worked a treat.

Had been banging my head about that one.

Best wishes

Darren