Expand my Community achievements bar.

Access particular field form repetitive subform and launch URL

Avatar

Level 1

Hi experts,

I have a repetitive subform ACCOUNT_ASSIGNMENT with a fields 'url' and a button (repetitive in each subform).

I needed to launch an URL on click of the button in each instance of the subform. Each instance of the subform would have a unique URL entered by the user.

The script that I am using fo rthis purpose is

app.launchURL(url.rawValue

, true);

But the problem here is that I am not able to acces the correspoding 'url' field value for every instance of this subform.

How do I achieve this is Javascript?

How do I resolve the node and access the corresponding 'url' textfield's rawvalue for the respective button?

Any help on this would be greatly appreciated.

Cheers,

Amith

8 Replies

Avatar

Former Community Member

Each field in the repeating subform will have a unique name based on th erepeating subform and the name of the field. So the pattern would be ACCOUNT_ASSIGNMENT[0].URL , ACCOUNT_ASSIGNMEN[1].URL , etc ....The occurance number of the subform is the index number of that subform . To get that index you can use this.parent.index. Now we know what number we need but we need to construct the object name and have it interpretted ...To do this you must use a different syntax:

xfa.resolveNode("ACCOUNT_ASSIGNMENT[" + this.parent.index + "]").URL.rawValue

So combining this with your goto URL instruction you woudl have:

, true);

app.launchURL(xfa.resolveNode("ACCOUNT_ASSIGNMENT[" + this.parent.index + "]").URL.rawValue

Hope that helps

Paul

Avatar

Level 1

Thank Paul for this quick response.

But I tried something of this sort in the 'Click' event of the button.

even -     var v1 = this.parent.index;

             xfa.host.messageBox("value is" +v1);

returned an undefined value.

So this would cause the resolveNode to fail. Am I doing something wrong here?

Regards,Amith

Avatar

Former Community Member

If the button is not part of the repeating subform then that will not work. You woudl have to put teh code on an object that is in the repeating subform. This also assumes that there is only one level of repeating subform.

Paul

Avatar

Level 1

Hey Paul,

It worked perectly... Thank you so much!! :-)

Cheers,

Amith

Avatar

Former Community Member

Hi Paul,

My old ID seems to be deleted for some reason. So I Created a new one.

Well, I have a an addition to this previous question.

I can use app.LaunchURL for links that use HTTP protocol. But now I wanted to access some docs that are shared on the internal network. i.e with an extension like \\servername\location\foldername\..........\foldername\filename.

Is there  a way to access these files? would something like app.opendoc( ) help? Please suggest somethig on Javascript and not formcalc.

Regards,
Amith

Avatar

Former Community Member

Yes the app.openDoc() is th eway to do it but you will not be able to pass the location of the file unless you certify the doc. Otherwise a file diaplog will open and th user cna choose a location and file to open.

Paul

Avatar

Former Community Member

Hi Paul,

What do you mean by 'certify the doc'?

I already have a link maintained. I just wanted to open the network folder to view the files.

Would this be possible? I tried it but it did not work for some reason

Regards,
Amith

Avatar

Former Community Member

It is a security issue to allow access to the file system without the users knowledge. Certifying the document allows scripts to run in a secure way in that the user knows and allows these scripts to run. This involves certifying that the documnet came from a trusted source (signing with a certificate ) and th euser must have the signing cert in their trusted store.

Paul