vendorCombo.onControlTextChanged = function(text){
// length of text in combo must be at least three or more chars
if (text.length > 2) {
var r = new AW.HTTP.Request;
r.setURL("../internal/matchVendorNameSnippet.asp");
r.setRequestMethod("POST");
r.setParameter("NM", text );
r.request();
r.response = function( data ) {
if ( data.substr(0,5) != "ERROR" ) {
// bold the sections with the match
bld = new RegExp( "(" + text + ")", "gi" );
data = data.replace( bld, "<strong>$1</strong>");
// split into array and remove the success marker
arr = data.replace(/SUCCESS:/, "").split("|");
vendorCombo.setItemCount( arr.length );
vendorCombo.setItemText( arr );
vendorCombo.setItemValue( arr );
vendorCombo.showPopup();
}
}
}
else {
vendorCombo.setItemCount( 0 );
vendorCombo.setItemText( null );
vendorCombo.setItemValue( null );
vendorCombo.hidePopup();
}
}
AW.UI.HTMLStripCombo = AW.UI.List.subclass();
AW.UI.HTMLStripCombo.create = function(){
AW.UI.ImageText.create.call(this);
AW.UI.Input.create.call(this);
AW.Templates.Combo.create.call(this);
var obj = this.prototype;
obj.setClass("ui", "combo");
obj.setClass("input", "");
obj.defineTemplate("popup", new AW.Templates.Frame);
obj.onCurrentItemChanged = function(i){
var text = this.getItemText(i);
this.setControlText(text);
this.hidePopup();
// strip-out any HTML tags from text
text = text.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig, "");
//text = text.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig, "");
var e = this.getContent("box/text").element();
if (AW.safari) {
e.innerHTML = text;
}
else {
e.value = text;
e.select();
}
e = null;
};
obj.setController("selection", {
onKeyUp: "selectPreviousItem",
onKeyDown: "selectNextItem",
onItemClicked: "selectClickedItem"
});
};
if ( (arr.length > 1) || (text != arr[0]) ) vendorCombo.showPopup();
obj.onCurrentItemChanged = function(i){
var text = this.getItemText(i);
// strip-out any HTML tags from text
text = text.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig, "");
this.setControlText(text);
this.hidePopup();
var e = this.getContent("box/text").element();
if (AW.safari) {
e.innerHTML = text;
}
else {
e.value = text;
e.select();
}
e = null;
};
versionCombo.setSelectedItems([2]);
versionCombo.setControlText(versionCombo.getItemText(versionCombo.getSelectedItems()).replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig, ""));
This topic is archived.