prmtGenTextBoxHTML.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| BI and PM: prmt
  5. *| (C) Copyright IBM Corp. 2002, 2022
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. ////////////////////////////////////////////////////////////////////
  13. // TextBox HTML generation functions
  14. ////////////////////////////////////////////////////////////////////
  15. // Function to create a textBox prompt control
  16. // sPromptId: The id of the prompt control (String)
  17. // sFormName: Name of form control to submit selections to the server (String)
  18. // sParameterName: Name of control element to be submitted to report server (String)
  19. // sDataType: ['number'|'currency'|'integer'|'natural'|'whole'|'percentage'] (String)
  20. // Default value is regular text.
  21. // sSubmitType: 'default' will submit as a standard form (String)
  22. // 'XML' will convert the submission to XML and submit
  23. // sDefaultValue: Default value for prompt control. If prompt control is a range, this represents the start value of the range. (String)
  24. // iInitialState: Range controls only. Controls whether to check radio buttons (Integer)
  25. // RANGE_NO_VALUE will select lowest to highest
  26. // RANGE_START_VALUE will select from a particular value to highest
  27. // RANGE_END_VALUE will select from lowest to a particular value
  28. // RANGE_BOUND_VALUE will select a range
  29. // RANGE_EQUAL_VALUE will select a single value
  30. // bRequired: If the control is a required field. (Boolean)
  31. // bShowThousandSeparator: If a thousand separator is used. (Boolean)
  32. // bMultiLine: If prompt control can accomodate multiple lines (e.g. simple text field vs textarea) (Boolean)
  33. // bAllowZero: If zeroes are to be allowed. (Boolean)
  34. // bHideAdornments: Hide icons (e.g. star icon for required controls) (Boolean)
  35. // bHideText: If text box is a password field. (Boolean)
  36. // bSuppressExtraPromptNames: Force report server to handle multiple prompt controls as a single entity (Boolean)
  37. // e.g. treat datetime control as a single date time, as opposed to treating date and time independntly
  38. // bMulti: If control can accomodate more than one value. (Boolean)
  39. // bRange: If control is a range. (Boolean)
  40. // bReadOnly: If control is read only. (Boolean)
  41. // bShowCondition: If the condition drop down is to be shown in the UI (Boolean)
  42. // sStyle: Style of prompt control. (String)
  43. // sMaxLength: Maximum length for text box. (String)
  44. // sEndValue: Optional. Only used for range controls. The end value of the range. (String)
  45. function genTextBoxHTML(sPromptId, sFormName, sParameterName, sDataType, sSubmitType, sDefaultValue, iInitialState, bRequired, bShowThousandSeparator, bMultiLine, bAllowZero, bHideAdornments, bHideText, bSuppressExtraPromptNames, bMulti, bRange, bReadOnly, bShowCondition, sStyle, sMaxLength, sEndValue)
  46. {
  47. var oProperties = sPromptId;
  48. if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT)
  49. {
  50. oProperties = {
  51. id: sPromptId,
  52. formName: sFormName,
  53. parameterName: sParameterName,
  54. allowZero: bAllowZero,
  55. dataType: sDataType,
  56. defaultValue: sDefaultValue,
  57. endValue: sEndValue,
  58. initialState: iInitialState,
  59. hideAdornments: bHideAdornments,
  60. hideText: bHideText,
  61. maxLength: sMaxLength,
  62. multiLine: bMultiLine,
  63. multi: bMulti,
  64. range: bRange,
  65. readOnly: bReadOnly,
  66. required: bRequired,
  67. showCondition: bShowCondition,
  68. showThousandSeparator: bShowThousandSeparator,
  69. style: sStyle,
  70. submitType: sSubmitType,
  71. supressExtraPromptNames: bSuppressExtraPromptNames };
  72. }
  73. if (oProperties.multi)
  74. {
  75. if (!oProperties.range) {
  76. genTextBoxMultipleHTML(oProperties);
  77. }
  78. else {
  79. oProperties.startValue = oProperties.defaultValue;
  80. genTextBoxRangeMultipleHTML(oProperties);
  81. }
  82. }
  83. else
  84. {
  85. if (oProperties.range)
  86. {
  87. oProperties.startValue = oProperties.defaultValue;
  88. genTextBoxRangeHTML(oProperties);
  89. }
  90. else
  91. {
  92. genTextBoxSingleHTML(oProperties);
  93. }
  94. }
  95. }
  96. function genTextBoxSingleHTML(s_PromptId, s_FormName, s_ParameterName, s_DataType, s_SubmitType, s_DefaultValue, b_Required, b_ShowThousandSeparator, b_MultiLine, b_AllowZero, b_HideAdornments, b_HideText, b_SuppressExtraPromptNames, s_Style, s_MaxLength, b_ReadOnly)
  97. {
  98. var oProperties = s_PromptId;
  99. if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT)
  100. {
  101. oProperties = {
  102. id: s_PromptId,
  103. formName: s_FormName,
  104. parameterName: s_ParameterName,
  105. allowZero: b_AllowZero,
  106. dataType: s_DataType,
  107. defaultValue: s_DefaultValue,
  108. hideAdornments: b_HideAdornments,
  109. hideText: b_HideText,
  110. maxLength: s_MaxLength,
  111. multiLine: b_MultiLine,
  112. readOnly: b_ReadOnly,
  113. required: b_Required,
  114. showThousandSeparator: b_ShowThousandSeparator,
  115. style: s_Style,
  116. submitType: s_SubmitType,
  117. supressExtraPromptNames: b_SuppressExtraPromptNames };
  118. }
  119. var sPromptId = oProperties.id;
  120. if (!verifyPromptId(sPromptId)) {
  121. return;
  122. }
  123. //skin folder
  124. var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN);
  125. var sFormName = oProperties.formName;
  126. if (!sFormName) {
  127. sFormName = "forms[0]";
  128. }
  129. var sParamName = "p_" + oProperties.parameterName;
  130. if (oProperties.suppressExtraPromptNames) {
  131. sParamName = sParamName.substring(1);
  132. }
  133. var oErrorImg = "document." + sFormName + ".imgTest" + sPromptId;
  134. if (oProperties.hideAdornments) {
  135. oErrorImg = null;
  136. }
  137. var sFormElementName = "_textEditBox" + sPromptId;
  138. var sStyle = oProperties.style;
  139. if (sStyle.match(/margin/i) === null) {
  140. sStyle += ";margin:0px;";
  141. }
  142. var sWidth=K_PRMT_sEMPTY;
  143. if( cssParser( oProperties.style, 'width') != K_PRMT_sEMPTY )
  144. {
  145. sWidth = 'width:100%;';
  146. }
  147. var HTMLOut = genHiddenInputHTML(sFormName, jsEncodeStr(sParamName), K_PRMT_sEMPTY) +
  148. "<fieldset class='clsFieldSet' style='" + sWidth + cssParser(oProperties.style, gsCSS_DEFAULT_STYLE + ((oProperties.multi==true||oProperties.range==true)?",width":K_PRMT_sEMPTY)) + "'>" +
  149. "<table cellpadding='0' cellspacing='0' border='0' style='"+sWidth+"'>" +
  150. "<tr>";
  151. if (!oProperties.hideAdornments)
  152. {
  153. HTMLOut +=
  154. "<td valign='top' width='10px'>" +
  155. "<table cellpadding='0' cellspacing='0' border='0'>";
  156. if (oProperties.required)
  157. {
  158. HTMLOut +=
  159. "<tr>" +
  160. "<td valign='top'><img src='" + sSkin + "/prompting/images/icon_required.gif' class='clsErrorRequired' align='top' height='10' width='10' border='0'/></td>" +
  161. "</tr>";
  162. }
  163. HTMLOut +=
  164. "<tr>" +
  165. "<td valign='middle'><img id='imgTest" + sPromptId + "' name='imgTest" + sPromptId + "' class='clsErrorRequired' src='" + sSkin + "/prompting/images/error_timed_small_off.gif' align='bottom' height='10' width='10' border='0'/></td>" +
  166. "</tr>" +
  167. "</table>" +
  168. "</td>";
  169. }
  170. HTMLOut +=
  171. "<td id='textEditBox" + sPromptId + "' style='" + sWidth + "'>";
  172. var sMaxLength = ( oProperties.maxLength !== K_PRMT_sEMPTY && !isNaN(oProperties.maxLength) ? " maxlength='" + oProperties.maxLength + "'" : K_PRMT_sEMPTY );
  173. var sCommonProperties =
  174. " class='clsTextWidget pt'" +
  175. " style='" + sWidth + cssParser(sStyle, 'color,font,text') + "'" +
  176. " onkeyup='textBox" + sPromptId + ".checkData();preventSubmitEvent(event)'" +
  177. " onKeyPress='return textBox" + sPromptId + ".keyPress(event)'" +
  178. " onblur='textBox" + sPromptId + ".lostFocus(); textBox" + sPromptId + ".endCheckDataInterval()'" +
  179. " oncontextmenu='textBox" + sPromptId + ".startCheckDataInterval(100)'";
  180. // Password field
  181. if (oProperties.hideText)
  182. {
  183. HTMLOut +=
  184. "<input type='password' autocomplete='off' name='" + sFormElementName + "'" + sCommonProperties + sMaxLength+ "/>";
  185. }
  186. // Single line edit box
  187. else if (!oProperties.multiLine)
  188. {
  189. HTMLOut +=
  190. "<input type='text' name='" + sFormElementName + "'" + sCommonProperties + sMaxLength+ "/>";
  191. }
  192. // Multi line edit box
  193. else
  194. {
  195. HTMLOut +=
  196. "<textarea name='" + sFormElementName + "' rows='7' cols='20'" + sCommonProperties + "></textarea>";
  197. }
  198. HTMLOut +=
  199. "</td>" +
  200. "</tr>" +
  201. "</table>" +
  202. "</fieldset>";
  203. renderPromptControlHTML("textBox" + sPromptId, HTMLOut);
  204. var sCVObj = getCVInstance(oProperties);
  205. var JSOut = "this.textBox" + sPromptId + " = new CText(document.forms[\"" + sFormName + "\"].elements[\""+ alterDoubleQuote(sParamName) + "\"], document.forms[\"" + sFormName + "\"].elements[\"" + sFormElementName + "\"]," + oErrorImg + ", '" + oProperties.dataType + "', " + '"' + oProperties.defaultValue.replace(/\\/g, "\\\\") + '"' + ", " + oProperties.required + ", '" + oProperties.submitType + "', " + oProperties.multiLine + ", " + oProperties.showThousandSeparator + ", " + oProperties.allowZero + ", document.getElementById('textEditBox" + sPromptId + "'), 'textBox" + sPromptId + "', " + oProperties.readOnly + ", '" + getCVId(oProperties) + "');" +
  206. sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('textBox" + sPromptId + "');";
  207. executePromptControlJS(JSOut);
  208. }
  209. function genTextBoxMultipleHTML(s_PromptId, s_FormName, s_ParameterName, s_DataType, s_SubmitType, s_DefaultValue, b_Required, b_ShowThousandSeparator, b_MultiLine, b_AllowZero, b_HideAdornments, b_HideText, b_SuppressExtraPromptNames, b_ShowCondition, s_Style, s_MaxLength)
  210. {
  211. var oProperties = s_PromptId;
  212. if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT)
  213. {
  214. oProperties = {
  215. id: s_PromptId,
  216. formName: s_FormName,
  217. parameterName: s_ParameterName,
  218. allowZero: b_AllowZero,
  219. dataType: s_DataType,
  220. defaultValue: s_DefaultValue,
  221. hideAdornments: b_HideAdornments,
  222. hideText: b_HideText,
  223. maxLength: s_MaxLength,
  224. multiLine: b_MultiLine,
  225. required: b_Required,
  226. showCondition: b_ShowCondition,
  227. showThousandSeparator: b_ShowThousandSeparator,
  228. style: s_Style,
  229. submitType: s_SubmitType,
  230. supressExtraPromptNames: b_SuppressExtraPromptNames };
  231. }
  232. var sPromptId = oProperties.id;
  233. if (!verifyPromptId(sPromptId)) {
  234. return;
  235. }
  236. //skin folder
  237. var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN);
  238. var sFormName = oProperties.formName;
  239. if (!sFormName) {
  240. sFormName = "forms[0]";
  241. }
  242. var sParamName = "p_" + oProperties.parameterName;
  243. if (oProperties.suppressExtraPromptNames) {
  244. sParamName = sParamName.substring(1);
  245. }
  246. var sFormElementName = sParamName;
  247. if (oProperties.submitType == K_PRMT_sXML) {
  248. sFormElementName = "_oLstChoices" + sPromptId;
  249. }
  250. var sWidth = K_PRMT_sEMPTY;
  251. var sFixedLayout = K_PRMT_sEMPTY;
  252. if( cssParser( oProperties.style, "width" ) != K_PRMT_sEMPTY )
  253. {
  254. sWidth = 'width:100%;';
  255. sFixedLayout = 'table-layout:fixed;';
  256. }
  257. var HTMLOut = K_PRMT_sEMPTY;
  258. if (oProperties.submitType == K_PRMT_sXML) {
  259. HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(sParamName), K_PRMT_sEMPTY);
  260. }
  261. HTMLOut += "<fieldset class='clsFieldSet' style='" + cssParser(oProperties.style, gsCSS_DEFAULT_STYLE) + "'>" +
  262. "<table style='"+ sWidth + "' border='0' cellpadding='0' cellspacing='0'>" +
  263. "<tr><td colspan='3'></td><td class='clsControlLabel pc' style='vertical-align:bottom;>";
  264. if (oProperties.showCondition)
  265. {
  266. HTMLOut += PMT_UIM_NEWVALUE;
  267. }
  268. HTMLOut += "</td></tr><tr>";
  269. if (oProperties.showCondition)
  270. {
  271. HTMLOut += "<td class='clsControlLabel pc' style='padding:0px 0px 5px 5px;'>";
  272. }
  273. else
  274. {
  275. HTMLOut += "<td class='clsControlLabel pc'>";
  276. }
  277. if (!oProperties.hideAdornments && oProperties.required) {
  278. HTMLOut += "<img src='" + sSkin + "/prompting/images/icon_required.gif' class='clsErrorRequired' align='top' height='10px' width='10px' border='0'/>";
  279. }
  280. if (oProperties.showCondition)
  281. {
  282. HTMLOut += PMT_UIM_CONDITION + "<br/>" +
  283. "<select name='oExcludeSelectedValues'>" +
  284. "<option value='false'>" + PMT_UIM_SHOWONLY + "</option>" +
  285. "<option value='true'>" + PMT_UIM_DONOTSHOW + "</option>" +
  286. "</select>";
  287. }
  288. else
  289. {
  290. HTMLOut += PMT_UIM_CHOICES;
  291. }
  292. HTMLOut += "</td></tr>" +
  293. "<tr><td valign='top' id='textBoxSingle" + sPromptId + "' style='"+ sWidth +"'></td>" +
  294. "<td width='5px'><img src='" + sSkin + "/prompting/images/spacer.gif' align='top' height='10' width='5' border='0'/></td>" +
  295. "<td valign='top' class='clsButtonLeftRightPadding' ><table border='0' cellpadding='2' cellspacing='0'>" +
  296. "<tr>" +
  297. "<td><table border='0' cellpadding='2' cellspacing='0'>" +
  298. "<tr>" +
  299. "<td id='getInsertButton" + sPromptId + "'></td>" +
  300. "</tr>" +
  301. "<tr>" +
  302. "<td id='getRemoveButton" + sPromptId + "'></td>" +
  303. "</tr>" +
  304. "<tr>" +
  305. "<td><img src='" + sSkin + "/prompting/images/spacer.gif' alt='' width='90' height='1'/></td>" +
  306. "</tr>" +
  307. "</table></td>" +
  308. "</tr></table>" +
  309. "</td>" +
  310. "<td valign='top'><table border='0' cellspacing='0' cellpadding='0'>" +
  311. "<tr>" +
  312. "<td><select name='" + sFormElementName + "' id='" + sFormElementName + "' style='" + sFixedLayout + cssParser(oProperties.style, 'color,font,text,height') + ";width:100%;overflow:scroll;' class='clsChoicesListbox pv' multiple='multiple' size='7' onmouseup=\"setTimeout('multipleText" + sPromptId + ".checkInsertRemove()', 100);\" onkeyup='multipleText" + sPromptId + ".catchDeleteKey(event.keyCode);'></select></td>" +
  313. "</tr>" +
  314. "<tr>" +
  315. "<td><div id='feedback" + sPromptId + "' class='clsFeedbackWidget'><img name='sizer" + sPromptId + "' src='" + sSkin + "/prompting/images/spacer.gif' alt='' width='100%' height='3'/></div></td>" +
  316. "</tr>" +
  317. "<tr>" +
  318. "<td align='right'>" +
  319. "<a href='javascript:multipleText" + sPromptId + ".selectAll();' class='clsLink pl'>" + PMT_UIM_SELECTALL + "</a>" +
  320. "&nbsp;" +
  321. "<a href='javascript:multipleText" + sPromptId + ".deSelectAll()' class='clsLink pl'>" + PMT_UIM_DESELECTALL + "</a>" +
  322. "</td>" +
  323. "</tr></table>" +
  324. "</td></tr></table>" +
  325. "</fieldset>";
  326. renderPromptControlHTML("textBox" + sPromptId, HTMLOut);
  327. var sCVObj = getCVInstance(oProperties);
  328. var JSOut = "genTextBoxSingleHTML(" +
  329. generatePromptProperties(oProperties, {
  330. id:"Single" + sPromptId,
  331. formName: sFormName,
  332. parameterName:"T_" + oProperties.parameterName,
  333. submitType: ( oProperties.submitType == K_PRMT_sNO_SUBMIT ? oProperties.submitType : K_PRMT_sEMPTY),
  334. defaultValue: K_PRMT_sEMPTY,
  335. required: false,
  336. style: cssParser(oProperties.style, "background,color,font-weight,font-style,font-family,text-decoration,font-size") + sWidth,
  337. suppressExtraPromptNames: true}) + ");" +
  338. "genInsertButtonHTML('" + sPromptId + "', 'multipleText" + sPromptId + ".insert()', 'insertButton" + sPromptId + "');" +
  339. "genRemoveButtonHTML('" + sPromptId + "', 'multipleText" + sPromptId + ".remove()', 'removeButton" + sPromptId + "');" +
  340. "this.multipleText" + sPromptId + " = new CMultipleTextPicker(textBoxSingle" + sPromptId + ", document.forms['" + sFormName + "'].elements['" + sFormElementName + "'], document.forms['" + sFormName + "'].elements['" + sParamName + "'], " + oProperties.required + ", '" + oProperties.submitType + "', document.getElementById('feedback" + sPromptId + "'), document.sizer" + sPromptId + ", document.getElementById('insertButton" + sPromptId + "'), document.getElementById('removeButton" + sPromptId + "'), '" + getCVId(oProperties) + "');" +
  341. sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('multipleText" + sPromptId + "');" +
  342. sCVObj + "multipleObserverArray = " + sCVObj + "multipleObserverArray.concat('multipleText" + sPromptId + "');";
  343. executePromptControlJS(JSOut);
  344. }
  345. function genTextBoxRangeHTML(s_PromptId, s_FormName, s_ParameterName, s_DataType, s_SubmitType, s_StartValue, s_EndValue, i_InitialState, b_Required, b_ShowThousandSeparator, b_MultiLine, b_AllowZero, b_HideAdornments, b_HideText, b_SuppressExtraPromptNames, s_Style, s_MaxLength)
  346. {
  347. var oProperties = s_PromptId;
  348. if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT)
  349. {
  350. oProperties = {
  351. id: s_PromptId,
  352. formName: s_FormName,
  353. parameterName: s_ParameterName,
  354. allowZero: b_AllowZero,
  355. dataType: s_DataType,
  356. endValue: s_EndValue,
  357. initialState: i_InitialState,
  358. hideAdornments: b_HideAdornments,
  359. hideText: b_HideText,
  360. maxLength: s_MaxLength,
  361. multiLine: b_MultiLine,
  362. required: b_Required,
  363. showThousandSeparator: b_ShowThousandSeparator,
  364. startValue: s_StartValue,
  365. style: s_Style,
  366. submitType: s_SubmitType,
  367. supressExtraPromptNames: b_SuppressExtraPromptNames };
  368. }
  369. var sPromptId = oProperties.id;
  370. if (!verifyPromptId(sPromptId)) {
  371. return;
  372. }
  373. //skin folder
  374. var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN);
  375. var sFormName = oProperties.formName;
  376. if (!sFormName) {
  377. sFormName = "forms[0]";
  378. }
  379. var sParamName = "p_" + oProperties.parameterName;
  380. if (oProperties.suppressExtraPromptNames) {
  381. sParamName = sParamName.substring(1);
  382. }
  383. var HTMLOut = K_PRMT_sEMPTY;
  384. var sWidth = K_PRMT_sEMPTY;
  385. if( cssParser( oProperties.style, "width" ) != K_PRMT_sEMPTY )
  386. {
  387. sWidth = 'width:100%;';
  388. }
  389. if (oProperties.submitType == K_PRMT_sXML) {
  390. HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(sParamName), K_PRMT_sEMPTY);
  391. }
  392. HTMLOut +=
  393. "<fieldset class='clsFieldSet' style='" + sWidth + cssParser(oProperties.style, gsCSS_DEFAULT_STYLE) + "'>" +
  394. "<table border='0' cellspacing='0' cellpadding='0' style='"+ sWidth + cssParser(oProperties.style,"height") + "'>" +
  395. "<tr>" +
  396. "<td class='clsControlLabel pc' colspan='2' nowrap='nowrap'>" + PMT_RNG_FROM + "</td>" +
  397. "</tr>" +
  398. "<tr>" +
  399. "<td nowrap='nowrap'>&nbsp;</td>" +
  400. "<td style='"+ sWidth +"' nowrap='nowrap' id='tdRangeFrom" + sPromptId + "'>" +
  401. "<table cellpadding='0' cellspacing='0' border='0'>" +
  402. "<tr>" +
  403. "<td valign='top'>";
  404. if (!oProperties.required)
  405. {
  406. HTMLOut +=
  407. "<input name='fromValue" + sPromptId + "' type='radio' onclick='range" + sPromptId + ".rangeNotify()'/>" +
  408. "</td>" +
  409. "<td style='padding-left:10px;'" +
  410. " onClick='range" + sPromptId + ".fromGotFocus();'" +
  411. " onkeyup='range" + sPromptId + ".fromCheckRadioState(event);'" +
  412. " onkeypress='if(event)range" + sPromptId + ".fromKeyPress(event.keyCode);'>";
  413. }
  414. // textBoxSingle prompt control for start range
  415. HTMLOut +=
  416. "<div style='" + sWidth + "' id='textBoxrange_from" + sPromptId + "' nowrap='nowrap'></div>" +
  417. "</td>" +
  418. "</tr>";
  419. if (!oProperties.required)
  420. {
  421. HTMLOut +=
  422. "<tr>" +
  423. "<td nowrap='nowrap'>" +
  424. "<input value='lowest' name='fromValue" + sPromptId + "' type='radio' checked='true' onclick='range" + sPromptId + ".rangeNotify()'/>" +
  425. "</td>" +
  426. "<td class='clsReadOnlyText pe' style='padding-left:10px;' onclick=\"document.forms['" + sFormName + "'].elements['fromValue" + sPromptId + "'][1].checked=true;range" + sPromptId + ".rangeNotify()\">" +
  427. PMT_RNG_LOWEST_VALUE +
  428. "</td>" +
  429. "</tr>";
  430. }
  431. HTMLOut +=
  432. "</table>" +
  433. "</td>" +
  434. "</tr>" +
  435. "<tr>" +
  436. "<td nowrap='nowrap' colspan='2'>&nbsp;</td>" +
  437. "</tr>" +
  438. "<tr>" +
  439. "<td class='clsControlLabel pc' colspan='2' nowrap='nowrap'>" + PMT_RNG_TO + "</td>" +
  440. "</tr>" +
  441. "<tr>" +
  442. "<td nowrap='nowrap'>&nbsp;</td>" +
  443. "<td style='"+ sWidth +"' nowrap='nowrap' id='tdRangeTo" + sPromptId + "'>" +
  444. "<table cellpadding='0' cellspacing='0' border='0'>" +
  445. "<tr>" +
  446. "<td valign='top'>";
  447. if (!oProperties.required)
  448. {
  449. HTMLOut +=
  450. "<input name='toValue" + sPromptId + "' type='radio' onclick='range" + sPromptId + ".rangeNotify()'/>" +
  451. "</td>" +
  452. "<td style='padding-left:10px;'" +
  453. " onClick='range" + sPromptId + ".toGotFocus();'" +
  454. " onkeyup='range" + sPromptId + ".toCheckRadioState(event);'" +
  455. " onkeypress='if(event)range" + sPromptId + ".toKeyPress(event.keyCode);'>";
  456. }
  457. // textBoxSingle prompt control for end range
  458. HTMLOut +=
  459. "<div style='" + sWidth + "' id='textBoxrange_to" + sPromptId + "' nowrap='nowrap'></div>" +
  460. "</td>" +
  461. "</tr>";
  462. if (!oProperties.required)
  463. {
  464. HTMLOut +=
  465. "<tr>" +
  466. "<td nowrap='nowrap'>" +
  467. "<input value='highest' name='toValue" + sPromptId + "' type='radio' checked='true' onclick='range" + sPromptId + ".rangeNotify()'/>" +
  468. "</td>" +
  469. "<td class='clsReadOnlyText pe' style='padding-left:10px;' onclick=\"document.forms['" + sFormName + "'].elements['toValue" + sPromptId + "'][1].checked=true;range" + sPromptId + ".rangeNotify()\">" +
  470. PMT_RNG_HIGHEST_VALUE +
  471. "</td>" +
  472. "</tr>";
  473. }
  474. HTMLOut +=
  475. "</table>" +
  476. "</td>" +
  477. "</tr>" +
  478. "</table>" +
  479. "</fieldset>";
  480. renderPromptControlHTML("textBox" + sPromptId, HTMLOut);
  481. var JSOut = "genTextBoxSingleHTML(" + generatePromptProperties(oProperties, {
  482. id:"range_from" + sPromptId,
  483. formName: sFormName,
  484. parameterName:"range_from" + oProperties.parameterName,
  485. submitType: ( oProperties.submitType == K_PRMT_sNO_SUBMIT ? oProperties.submitType : K_PRMT_sEMPTY),
  486. defaultValue: oProperties.startValue,
  487. multiLine: false,
  488. allowZero: true,
  489. hideText: false,
  490. hideAdornments:true,
  491. style: cssParser(oProperties.style, 'background,color,font,text') + sWidth,
  492. suppressExtraPromptNames: true}) + ");" +
  493. "genTextBoxSingleHTML(" + generatePromptProperties(oProperties, {
  494. id:"range_to" + sPromptId,
  495. formName: sFormName,
  496. parameterName:"range_to" + oProperties.parameterName,
  497. submitType: ( oProperties.submitType == K_PRMT_sNO_SUBMIT ? oProperties.submitType : K_PRMT_sEMPTY),
  498. defaultValue: oProperties.endValue,
  499. multiLine: false,
  500. hideAdornments:true,
  501. allowZero: true,
  502. hideText: false,
  503. style: cssParser(oProperties.style, 'background,color,font,text') + sWidth,
  504. suppressExtraPromptNames: true}) + ");";
  505. if (oProperties.required) {
  506. JSOut += "this.range" + sPromptId + " = new CRange(document.forms['" + sFormName + "'].elements['" + alterDoubleQuote(sParamName) + "'], null, textBoxrange_from" + sPromptId + ", null, null, textBoxrange_to" + sPromptId + ", null, '" + oProperties.dataType + "', true, '" + oProperties.submitType + "', null, '" + getCVId(oProperties) + "');";
  507. }
  508. else {
  509. JSOut += "this.range" + sPromptId + " = new CRange(document.forms['" + sFormName + "'].elements['" + alterDoubleQuote(sParamName) + "'], document.forms['" + sFormName + "'].elements['fromValue" + sPromptId + "'][0], textBoxrange_from" + sPromptId + ", null, document.forms['" + sFormName + "'].elements['toValue" + sPromptId + "'][0], textBoxrange_to" + sPromptId + ", null, '" + oProperties.dataType + "', false, '" + oProperties.submitType + "', " + oProperties.initialState + ", '" + getCVId(oProperties) + "');";
  510. }
  511. var sCVObj = getCVInstance(oProperties);
  512. JSOut += sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('range" + sPromptId + "');" +
  513. sCVObj + "rangeObserverArray = " + sCVObj + "rangeObserverArray.concat('range" + sPromptId + "');";
  514. executePromptControlJS(JSOut);
  515. }
  516. function genTextBoxRangeMultipleHTML(s_PromptId, s_FormName, s_ParameterName, s_DataType, s_SubmitType, s_StartValue, s_EndValue, i_InitialState, b_Required, b_ShowThousandSeparator, b_MultiLine, b_AllowZero, b_HideAdornments, b_HideText, b_SuppressExtraPromptNames, s_Style, s_MaxLength)
  517. {
  518. var oProperties = s_PromptId;
  519. if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT)
  520. {
  521. oProperties = {
  522. id: s_PromptId,
  523. formName: s_FormName,
  524. parameterName: s_ParameterName,
  525. allowZero: b_AllowZero,
  526. dataType: s_DataType,
  527. endValue: s_EndValue,
  528. initialState: i_InitialState,
  529. hideAdornments: b_HideAdornments,
  530. hideText: b_HideText,
  531. maxLength: s_MaxLength,
  532. multiLine: b_MultiLine,
  533. required: b_Required,
  534. showThousandSeparator: b_ShowThousandSeparator,
  535. startValue: s_StartValue,
  536. style: s_Style,
  537. submitType: s_SubmitType,
  538. supressExtraPromptNames: b_SuppressExtraPromptNames };
  539. }
  540. var sPromptId = oProperties.id;
  541. if (!verifyPromptId(sPromptId)) {
  542. return;
  543. }
  544. //skin folder
  545. var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN);
  546. var sFormName = oProperties.formName;
  547. if (!sFormName) {
  548. sFormName = "forms[0]";
  549. }
  550. var sParamName = "p_" + oProperties.parameterName;
  551. if (oProperties.suppressExtraPromptNames) {
  552. sParamName = sParamName.substring(1);
  553. }
  554. var sFixedLayout = K_PRMT_sEMPTY;
  555. var sWidth = K_PRMT_sEMPTY;
  556. if( cssParser( oProperties.style, "width" ) != K_PRMT_sEMPTY )
  557. {
  558. sWidth = 'width:100%;';
  559. sFixedLayout = "table-layout:fixed;";
  560. }
  561. var HTMLOut = K_PRMT_sEMPTY;
  562. if (oProperties.submitType == K_PRMT_sXML) {
  563. HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(sParamName), K_PRMT_sEMPTY);
  564. }
  565. HTMLOut += "<fieldset class='clsFieldSet' style='" + cssParser(oProperties.style, gsCSS_DEFAULT_STYLE)+"'>";
  566. HTMLOut += "<table cellpadding='0' cellspacing='0' border='0' style='"+sFixedLayout+ cssParser(oProperties.style,"height") + "'>" +
  567. "<tr>" +
  568. // textBoxRange prompt control
  569. "<td valign='top' align='left' id='textBoxr_" + sPromptId + "' style='" + sWidth + "'></td>" +
  570. "<td valign='top' class='clsButtonLeftRightPadding' >" +
  571. "<table border='0' cellpadding='0' cellspacing='0'>" +
  572. "<tr>" +
  573. "<td><img src='" + sSkin + "/prompting/images/spacer.gif' alt='' width='1' height='16'/></td>" +
  574. "</tr>" +
  575. "</table>" +
  576. "<table border='0' cellpadding='2' cellspacing='0'>" +
  577. "<tr>" +
  578. "<td id='getInsertButton" + sPromptId + "'></td>" +
  579. "</tr>" +
  580. "<tr>" +
  581. "<td id='getRemoveButton" + sPromptId + "'></td>" +
  582. "</tr>" +
  583. "<tr>" +
  584. "<td><img src='" + sSkin + "/prompting/images/spacer.gif' alt='' width='90' height='1'/></td>" +
  585. "</tr>" +
  586. "</table>" +
  587. "</td>" +
  588. "<td valign='top'>" +
  589. "<table border='0' cellspacing='0' cellpadding='0' width='100%'>" +
  590. "<tr>" +
  591. "<td class='clsControlLabel pc'>";
  592. if (oProperties.required) {
  593. HTMLOut += "<img src='" + sSkin + "/prompting/images/icon_required.gif' class='clsErrorRequired' align='top' height='10' width='10' border='0'/>";
  594. }
  595. HTMLOut += PMT_UIM_CHOICES + "</td>" +
  596. "</tr>" +
  597. "<tr>" +
  598. "<td>" +
  599. "<select name='_oLstChoices" + sPromptId + "' style='" + sFixedLayout + cssParser(oProperties.style, 'color,font,text,height') + "' class='clsChoicesListbox pv' multiple='multiple' onmouseup=\"setTimeout('multipleRange" + sPromptId + ".checkInsertRemove()', 100);\" size='7' onkeyup='multipleRange" + sPromptId + ".catchDeleteKey(event.keyCode)'></select>" +
  600. "</td>" +
  601. "</tr>" +
  602. "<tr>" +
  603. "<td>" +
  604. "<div id='multipleRangeFeedback" + sPromptId + "' class='clsFeedbackWidget'>" +
  605. "<img name='sizer" + sPromptId + "' src='" + sSkin + "/prompting/images/spacer.gif' alt='' width='100%' height='3'/>" +
  606. "</div>" +
  607. "</td>" +
  608. "</tr>" +
  609. "<tr>" +
  610. "<td align='right' nowrap>" +
  611. "<a href='javascript:multipleRange" + sPromptId + ".selectAll()' class='clsLink pl'>" + PMT_UIM_SELECTALL + "</a>" +
  612. "&nbsp;" +
  613. "<a href='javascript:multipleRange" + sPromptId + ".deSelectAll()' class='clsLink pl'>" + PMT_UIM_DESELECTALL + "</a>" +
  614. "</td>" +
  615. "</tr>" +
  616. "</table>" +
  617. "</td>" +
  618. "</tr>" +
  619. "</table></fieldset>";
  620. renderPromptControlHTML("textBox" + sPromptId, HTMLOut);
  621. var sCVObj = getCVInstance(oProperties);
  622. var JSOut = "genTextBoxRangeHTML(" + generatePromptProperties(oProperties, {
  623. id: "r_" + sPromptId,
  624. formName: sFormName,
  625. parameterName: "r_" + oProperties.parameterName,
  626. startValue: K_PRMT_sEMPTY,
  627. endValue: K_PRMT_sEMPTY,
  628. style: cssParser(oProperties.style, 'background,color,font,text') + sWidth,
  629. required: false,
  630. suppressExtraPromptNames: false}) + ");" +
  631. "genInsertButtonHTML('" + sPromptId + "', 'multipleRange" + sPromptId + ".insertChoiceList()', 'insertButton" + sPromptId + "');" +
  632. "genRemoveButtonHTML('" + sPromptId + "', 'multipleRange" + sPromptId + ".removeChoiceList()', 'removeButton" + sPromptId + "');" +
  633. "this.multipleRange" + sPromptId + " = new CMultipleRange(ranger_" + sPromptId + ", document.forms['" + sFormName + "'].elements['_oLstChoices" + sPromptId + "'], document.forms['" + sFormName + "'].elements['" + sParamName + "'], " + oProperties.required + ", '" + oProperties.submitType + "', document.getElementById('multipleRangeFeedback" + sPromptId + "'), document.sizer" + sPromptId + ", '" + sPromptId + "', document.getElementById('insertButton" + sPromptId + "'), document.getElementById('removeButton" + sPromptId + "'), '" + getCVId(oProperties) + "');" +
  634. sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('multipleRange" + sPromptId + "');" +
  635. sCVObj + "multipleObserverArray = " + sCVObj + "multipleObserverArray.concat('multipleRange" + sPromptId + "');" +
  636. "multipleRange" + sPromptId + ".initChoiceList();";
  637. executePromptControlJS(JSOut);
  638. }