12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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>' +
- '.myButton { margin-right:8px; color:#6793CB; font-size:20px; padding:6px 12px 6px 12px; background-color:white; border:1px solid #6793CB; }' +
- '.myButton:hover { background-color:#6793CB; color:white; border:1px solid #6793CB; }' +
- '</style>' +
- '<button class="myButton btnCancel" type="button">Cancel</button>' +
- '<button class="myButton btnFinish" type="button">Finish</button>' ;
- 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;
- });
|