dataObjects property doesn't work properly

arthurf48713214 29-05-2018

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

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (3)

Answers (3)

BR001
MVP
29-05-2018

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

arthurf48713214 29-05-2018

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

BR001
MVP
29-05-2018

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