Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

dataObjects property doesn't work properly

Avatar

Level 3

Hey,

a Thank to everyone that take their time to give me answer to my questions especially to Bruce.

I have a litle problem. I want check if there are some attachments files on my form then i want gire their name if no i just want to hidde the field.

I saw some exmaples on internet with dataObjects. but when i use it on my script it send me this error.  ->

Script failed (language is javascript; context is xfa[0].form[0].Benteler3DMaster[0].TOC[0].attachedFilesName[0])

script = var myDoc = event.target;

var attachments = myDoc.dataObjects;

if (attachments !== null) {

this.rawValue = "not files found";

} else {

this.rawValue = "there are some files";

}

Error: Invalid property get operation; field doesn't have property 'dataObjects'

i use Designer aem 6.3 form.

thx

regards

Arthur

3 Replies

Avatar

Level 10

Hi Arthur,

What event is this script running in, the calculate event?  It looks ok to me syntactical , but haven't you the condition

if (attachments !== null) {

around the wrong way, look like it should be

if (attachments === null) {

You should get a line number in the error message, have you dropped that off when pasting into the forum?

Bruce

Avatar

Level 3

yes i run it in the calculate event on the server side.

there is thre error message ->  Error: Invalid property get operation; field doesn't have property 'dataObjects'.

when i initialize a variable like var doc = event.target; i dont receive any error , but when i add dataObjects i receive an error like  Error: Invalid property get operation; field doesn't have property 'dataObjects'

i changed the if statement but i receive the same error.

Arthur

Avatar

Level 10

Hi,

Probably can't help with any server side questions, I haven't done much and haven't an environment to test with.

But, your error does seem strange, like you have a field object called myDoc which is confusing the JavaScript engine. Is that possible?

Also there should be a line or two before that message which gives the context of the error, something like;

XFAObject.xxxxxxxx:4:XFA:form1[0]:subform[0]:TextField1[0]:calculate​

Maybe a screen shot will help.

Bruce