Expand my Community achievements bar.

Having problem in visible/hidden

Avatar

Level 2

I am using same script under two subform section 1 and section 2. When click on button under section1, this script is working well, but section 2 not working.

Again if I click on the button section 2, it is working well, but section 1 not working then. Each section withstand other section. I have seen presence action get corrupted.

var sec = xfa.resolveNodes("images.thumb[*]");

outer:

for(var i=0; i<sec.length; i++)

    {

    if(sec.item(i).thum.rawValue == null)

        {

        if (event.target.importDataObject("name"))

        {

            var attachmentObject = event.target.getDataObject("name");

            var filetype = attachmentObject.path.substring(attachmentObject.path.lastIndexOf(".") + 1);

            if (filetype === "jpg" || filetype === "JPEG" || filetype === "png" || filetype === "bmp" || filetype === "JPG")

            {

                var imageStream = event.target.getDataObjectContents("name");

                var imageStreamEncoded = Net.streamEncode(imageStream, "base64");

                sec.item(i).presence = "visible";

                sec.item(i).thum.rawValue = util.stringFromStream(imageStreamEncoded);

                break;

            }

            else {app.alert("Please insert correct format image");}

        }

        else { break outer;} //if cancel

    }   

}

What should I do now?

2 Replies

Avatar

Level 10

Hi,

This looks ok, but how are the thumb rows being added?  Maybe it is worth putting some console.println("...") statements after the "if(sec.item(i).thum.rawValue == null)" and see if it is getting past that?  If there is only one thumb row then whichever is the first button to click will be the one that works.

Regards

Bruce

Avatar

Level 2

Thanks for your reply.

I am getting browser option to attach image too. I have seen section 1 and 2 are not flowable, but auto hide. All parent subforms are flowable. When I make all flowable all working well. Now I have changed layout, all working well.

Do you think only child subform which is auto hide, withstands 2nd time to visible?  Actually I like your idea, stong script. You know this attachment script is yours. I like your blog too.

Thanks for sharing your profound knowledge with us.