ui5-validator icon indicating copy to clipboard operation
ui5-validator copied to clipboard

Validate required fields

Open lasterra opened this issue 9 years ago • 5 comments

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() }) ); } }

lasterra avatar Aug 17 '16 10:08 lasterra

Could you please share complete code and plunker link so it will be easy to add

tejashwiniChenna avatar Sep 02 '17 11:09 tejashwiniChenna

@lasterra I've included your enhancement in my pull request #11

dmnk avatar Oct 24 '18 13:10 dmnk

@dmnk unfortunately doesn't work for me, see #13

TimoStahl avatar Oct 29 '18 11:10 TimoStahl

i'm on it, however i can't give you an estimation when it's fixed. Thanks for the nice test-cases

dmnk avatar Oct 29 '18 12:10 dmnk

Hi,

Please check whether this solution satisfies requirement: http://plnkr.co/edit/5Wxy5wzv11sGj3UQ?preview

Regards, Vladimirs

vpasedko avatar Aug 04 '20 18:08 vpasedko