123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- define(function () {
- "use strict";
- function validatePromptValue() {
- };
- validatePromptValue.prototype.draw = function (oControlHost) {
- //this.m_sName = oControlHost.configuration.name || "listBoxPL";
- var el = oControlHost.container;
- el.innerHTML =
- '<style>' +
- '.MyPromptButton' +
- '{' +
- 'background-color: white;' +
- 'border: 2px solid #4178BE;' +
- 'color: #4178be;' +
- 'font-size: 14px;' +
- 'height: 32px;' +
- 'width: 120px;' +
- 'margin-left: 20px;' +
- 'cursor: pointer;' +
- '} ' +
- '.MyPromptButton:hover' +
- '{' +
- 'background-color: #4178BE;' +
- 'color: white;' +
- '}' +
- '</style>' +
- '<button class="MyPromptButton btn1">Submit</button>' +
- '<button class="MyPromptButton btn2">Cancel</button>';
- el.querySelector(".btn1").onclick = this.MyPromptButtonFinishClick.bind(this, oControlHost);
- el.querySelector(".btn2").onclick = oControlHost.cancel.bind(oControlHost);
- };
- validatePromptValue.prototype.MyPromptButtonFinishClick = function (oControlHost)
- {
- var productLinePrompt = oControlHost.page.getControlByName("listBoxPL");
- var orderTypePrompt = oControlHost.page.getControlByName("listBoxOT");
- var plValues = productLinePrompt.getValues();
- if (plValues && plValues.length > 0) {
- var productLineSelection = plValues[0]['use'];
- var otValues = orderTypePrompt.getValues();
- if (otValues && otValues.length > 0) {
- var orderTypeSelection = otValues[0]['use'];
- if (productLineSelection == 'Camping Equipment' && orderTypeSelection == 'Fax') {
- // Pop up an error message for the user
- alert("You cannot select Camping Equipment and Fax.");
- // Clear the prompt selections
- productLinePrompt.clearValues();
- orderTypePrompt.clearValues();
- return ;
- }
- else {
- // Submit the prompt values calling the finish method
- oControlHost.finish()
- }
- }
- }
- };
- return validatePromptValue;
- });
|