Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Interesting addInstance problem

Avatar

Former Community Member

Am reading data from the database now using FormCalc, and can have differing number of dynamic subforms depending on the number of entries of a particular kind.

I generate the proper number of subforms to match the data, but I can't access the fields in the subform to fill them in.

          while (oDataConn.isEOF() == false)do
               // Create a new instance and get a reference to it.
            var oSPC_1 = form1.SPC_1_Deadline_SF.SPC_1_List._SPC_1_Bldg_Info.addInstance(0)

            oSPC_1.BuildingNumber.rawValue = something

 
            oDataConn.next()
          endwhile

Gives me an error that the accessor oSPC_1.BuildingNumber.rawValue is unknown.

Any idea what I'm doing wrong, or more likely what I am addressing wrong?

Thanks in advance.

Patrick

1 Accepted Solution

Avatar

Correct answer by
Level 10

1. try to invoke the JavaScript method written in a Script Object as

scrObjName.jsFunctionName();

if this is not helps,try #2

2. Place your Javascript code in click event of a button (hidden button)

Form your formcalc code write:

btnHidden.execEvent("click")

Hope this atleast will help.

Nith

DISCLAIMER:

========================================================================

"This communication is intended only for the named recipient and others authorized to receive it.

It contains confidential or legally privileged information. If you are not the intended recipient, please notify us immediately, and note that any disclosure, copying, distribution or action you may take in reliance on this communication is strictly prohibited and may be unlawful. Unless indicated otherwise, this communication is not intended, nor should it be taken to create any legal and/or contractual relation or otherwise. Ministry of Finance (MOF) is neither liable for the proper and complete transmission of the communication, nor for any delay in its receipt.

Whilst MOF undertakes all reasonable efforts to screen outgoing e-mails for viruses, it cannot be held liable for any viruses transmitted by this e-mail."

View solution in original post

8 Replies

Avatar

Level 10

Can you post your form?

There must be some hierarchical structure issue.

Nith

Avatar

Level 10

The problem is invalid reference to the field BuildingNumber

The actual field name is BldgNumber

Nith

Avatar

Former Community Member

Still gives the error about not finding the accessor.

Avatar

Level 10

Surround your code within try catch block and locate the issue. Definitely this time you will not get the error at the same location.

Nith

Avatar

Former Community Member

Have tried using calculate or validate of a dummy field (just like setting the static names on the master page) in Javascript and it seems to be working a bit better.

It works but only pn the last value.  If I have 7 entries, it only sees the 7th one.

Any advice on how toi get the formcalc main portion to call a Javascript event or function.

Thanks,

Patrick

Avatar

Correct answer by
Level 10

1. try to invoke the JavaScript method written in a Script Object as

scrObjName.jsFunctionName();

if this is not helps,try #2

2. Place your Javascript code in click event of a button (hidden button)

Form your formcalc code write:

btnHidden.execEvent("click")

Hope this atleast will help.

Nith

DISCLAIMER:

========================================================================

"This communication is intended only for the named recipient and others authorized to receive it.

It contains confidential or legally privileged information. If you are not the intended recipient, please notify us immediately, and note that any disclosure, copying, distribution or action you may take in reliance on this communication is strictly prohibited and may be unlawful. Unless indicated otherwise, this communication is not intended, nor should it be taken to create any legal and/or contractual relation or otherwise. Ministry of Finance (MOF) is neither liable for the proper and complete transmission of the communication, nor for any delay in its receipt.

Whilst MOF undertakes all reasonable efforts to screen outgoing e-mails for viruses, it cannot be held liable for any viruses transmitted by this e-mail."

Avatar

Former Community Member

execEvent did the trick.  Plus making sure all the binding and repeat counts are correct. .

Thanks.

Patrick