This thing is needed when your customers wants to select value from existing list and to have possibility to create a new ones but they are too lazy to use Lookups
Demonstration
Code
My attribute called spec located in z_wf_wl factory. Notepad's Replace all function should be enough to refactor this code.
form side:
function switchComboBox(obj) {
if (!jq("#spec_attr").length)
jq("[pdmqa='spec_fake']").parent().append(
jq(document.createElement('input'))
.attr({id : "spec_attr", name : "SET.spec"})
.hide()
);
if (jq(obj).val() == "<NEW_VALUE>")
jq("#spec_attr").show().val("");
else
jq("#spec_attr").hide().val(jq(obj).val());
}
detailSetEventHandler("onchange='switchComboBox(this);'");
detailDropdown("Specialization", "spec_fake", "pri", 1, 40,
false, "", "$args.spec",
"no", "spec", "$args.spec",
"","","no","","",
"$args.spec",
<PDM_LIST prefix=list where="spec is not NULL" factory=z_wf_wl domset="spec_types">
"$list.spec", "$list.spec",
</PDM_LIST>
"New Type:", "<NEW_VALUE>"
);
spel side:
OBJECT z_wf_wl {
FACTORY {
DOMSET spec_types "spec" STATIC {
DISTINCT;
};
};
};