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( ".btnCancel" ).onclick = oControlHost.cancel.bind( oControlHost );
el.querySelector( ".btnFinish" ).onclick = this.finishButtonClick.bind(this, oControlHost);
};
validatePromptValue.prototype.finishButtonClick = 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{
oControlHost.finish()
}
}
}
};
return validatePromptValue;
});