add autopopulation parameter to lookupinit

This commit is contained in:
John Mitchell 2015-06-09 16:10:15 -04:00
parent 3c2f3f323a
commit df5a0a76d8

View File

@ -38,9 +38,16 @@ export default
instructions = params.instructions,
postAction = params.postAction,
callback = params.callback,
autopopulateLookup,
input_type = (params.input_type) ? params.input_type: "checkbox",
defaultUrl, name, watchUrl;
if (params.autopopulateLookup !== undefined) {
autopopulateLookup = params.autopopulateLookup;
} else {
autopopulateLookup = true;
}
if (params.url) {
// pass in a url value to override the default
defaultUrl = params.url;
@ -67,8 +74,11 @@ export default
sourceField = form.fields[field].sourceField;
// this logic makes sure that the form is being added, and that the lookup to be autopopulated is required
// we also look to see if the lookupinit autopopulateLookup parameter passed in by the controller is false
function fieldIsAutopopulatable() {
if (parent_scope.mode === "add") {
if (autopopulateLookup === false) {
return false;
} if (parent_scope.mode === "add") {
if (parent_scope[sourceModel + "_field"].awRequiredWhen &&
parent_scope[sourceModel + "_field"].awRequiredWhen.variable &&
parent_scope[parent_scope[sourceModel + "_field"].awRequiredWhen.variable]) {