This slowness really puzzles me... because I just tried hard-coding the data and ran it on a local Turnkey version of LC-ES, and the form got loaded rather quickly. Could somebody shed some lights on this please?
here's what happens:
on my fast version, it uses the same XDP that has 11 dropdown fields. and in the "ready:form" event, I have this piece of Java Script running at Client:
var astrChoiceList;
var choices;
// Clear drop-down list box
P1.CompanyCode.clearItems();
P1.Cocode1.clearItems();
P1.Cocode2.clearItems();
P1.Cocode3.clearItems();
P1.Cocode4.clearItems();
P1.Cocode5.clearItems();
P1.Cocode6.clearItems();
P1.Cocode7.clearItems();
P1.Cocode8.clearItems();
P1.Cocode9.clearItems();
P1.Cocode10.clearItems();
astrChoiceList = "0002,0003,0004,0005,0007,0008,0009,0010,0011,0012,0013,0014,0015,0016,0017,0018,0019,0021,0023,0024,0025,0026,0027,0028,0029,0031,0033,0034,0035,0036,0037,0038,0039,0040,0041,0042,0043,0044,0046,0047,0049,0050,0051,0053,0054,0055,0056,0057,0058,0059,0060,0062,0063,0069,0070,0072,0073,0074,0075,0077,0078,0079,0080,0081,0082,0083,0084,0085,0086,0087,0088,0091,0092,0093,0095,0096,0097,0098,0099,0100,0103,0104,0105,0106,0107,0108,0109,0110,0111,0112,0113,0114,0115,0116,0117,0118,0119,0120,0121,0122,0123,0124,0125,0126,0128,0129,0130,0134,0135,0136,0137,0138,0139,0144,0145,0146,0147,0148,0149,0150,0151,0153,0154,0155,0156,0157,0158,0159,0160,0162,0163,0164,0165,0166,0167,0168,0169,0171,0172,0173,0174,0175,0176,0177,0178,0179,0180,0181,0182,0183,0184,0185,0186,0187,0188,0189,0190,0192,0193,0194,0195,0196,0197,0198,0199,0200,0201,0202,0203,0204,0205,0206,0207,0208,0209,0210,0211,0212,0213,0214,0215,0216,0217,0218,0219,0220,0221,0222,0223,0224,0225,0226,0227,0228,0229,0230,0231,0232,0235,0236,0249,0251,0252,0253,0254,0255,0256,0258,0259,0260,0261,0262,0266,0267,0268,0269,0270,0271,0272,0273,0274,0275,0276,0277,0278,0279,0280,0281,0282,0283,0284,0285,0286,0287,0288,0289,0290,0291,0292,0293,0294,0295,0296,0298,0299,0300,0301,0302,0303,0304,0305,0306,0307,0308,0309,0310,0311,0312,0313,0314,0315,0316,0317,0318,0319,0320,0321,0322,0323,0324,0325,0326,0327,0328,0329,0330,0331,0332,0333,0334,0335,0336,0337,0338,0339,0340,0341,0342,0343,0344,0345,0346,0347,0348,0349,0350,0351,0352,0353,0354,0355,0356,0357,0358,0359,0360,0361,0362,0363,0364,0365,0366,0367,0368,0369,0374,0375,0376,0377,0378,0379,0380,0381,0382,0383,0384,0385,0386,0387,0388,0389,0390,0391,0392,0393,0394,0395,0396,0397,0398,0399,0400,0401,0402,0403,0404,0405,0406,0407,0408,0409,0410,0411,0412,0413,0414,0415,0416,9002,9003,9017,9018,9019,9021,9022,9023,9057,9062,9070,9071,9072,9073,9074,9077,9078,9082,9093,9127,9134,9140,9141,9142,9143,9160,9161,9168,9183,9191";
// add each choice to the dropdown list
choices = astrChoiceList.split(",");
var numchoices = choices.length;
for (var i = 0; i < numchoices; i++) { P1.CompanyCode.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode1.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode2.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode3.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode4.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode5.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode6.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode7.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode8.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode9.addItem(choices[i], choices[i]); }
for (var i = 0; i < numchoices; i++) { P1.Cocode10.addItem(choices[i], choices[i]); }
as I mentioned, the "astrChoiceList" variable is hard-coded with some data as you can see above.
The process is the standard "Render PDF Form" in the Samples.
and it worked pretty quickly. there was no slowness.
However, in the slow version, it has the same fields, the only differene is that the "astrChoiceList" variable is not hard-coded, it's like this:
astrChoiceList = P1.fieldName.rawvalue;
the data is stored in a hidden field called "fieldName".
the rest of the script is exactly the same as the fast version.
The process for the slow version uses a custom Render service. That Render service queries a database table to get the data, and put it in the hidden field "fieldName". The rest of process is identical to the "Render PDF Form" in the Samples. The data taken from the database is identical to the hard-coded data in the fast version.
I cannot figure out why these differences would cost the slow version 2 minutes slower in loading the form. Could somebody tell me why?
thanks
James