define(function () {
"use strict";
function validatePromptValue() {
};
validatePromptValue.prototype.draw = function (oControlHost) {
//this.m_sName = oControlHost.configuration.name || "listBoxPL";
var el = oControlHost.container;
el.innerHTML =
'' +
'' +
'';
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;
});