Skip to content

Validate required fields #5

@lasterra

Description

@lasterra

Sometimes i only want to validate required fields... that maybe they don't have a Type, for example with ComboBox controls.

I make a simple change on validation to control this situation

Hope you like it,.

if (oControl.getBinding(aValidateProperties[i])) {
///original code
}else if (oControl.getRequired && oControl.getRequired()===true) {
oControlBinding = oControl.getBinding(aValidateProperties[i]);
oExternalValue = oControl.getProperty(aValidateProperties[i]);
if (!oExternalValue || oExternalValue==="") {
this._isValid = false;
sap.ui.getCore().getMessageManager().addMessages(
new Message({
message: "",
type: MessageType.Error,
target : ( oControlBinding.getContext() ? oControlBinding.getContext().getPath() + "/" : "") +
oControlBinding.getPath(),
processor: oControl.getBinding(aValidateProperties[i]).getModel()
})
);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions