Skip to Content

Unable to set value as null to smart field in SAPUI5

Dear experts,

I have used a smart field inside a Simple Form in a dialog fragment and the entity set was also bound correctly , F4 help is also working fine. But I am trying to clear the value every time I opens the dialog fragment, but the value is never cleared from the input area.

Can some body help me if there is any work around for this issue.

Controller Code:

forwardWrkItem: function(oEvt){
			var oView = this.getView();
				this.fwdWrkItmDialog = sap.ui.xmlfragment(this.getView().getId(),"com.myinbox.view.ForwardWrkItm",this);
Fragment Code: 

<core:FragmentDefinition xmlns="sap.m"
	xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form"
	xmlns:ui="sap.ui.table" xmlns:core="sap.ui.core">

	<Dialog width="auto" noDataText="{i18n>categoryNoData}">
					<Label text="{i18n>FwdWrkItms}"
						class="sapUiTinyMarginBeginEnd" />
			<VBox class="sapUiTinyMarginBeginEnd">
				<Label text="{myinbox>/DetailViewData/Subject}" />
				<Text text="{i18n>FwdDlgItmHdrTxt}" level="H2" />
				<f:SimpleForm editable="true"
					layout="ResponsiveGridLayout" class="sapUiNoMargin">
						<smartField:SmartLabel labelFor="fwdUserId"
								<l:GridData spanL="2" spanM="2" spanS="2" />
						<smartField:SmartField value="{bname}"
							id="fwdUserId" entitySet="ZC_USER_F4HELP">
								<l:GridData spanL="6" spanM="6" spanS="6" />

			<Button id="fwdDialogOk" text="{i18n>Ok}"
				press="handleForwardToUser" type="Emphasized" />
			<Button id="fwdDCancel" text="{i18n>Cancel}"
				press="closeFwdDialog" type="Emphasized" />


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Feb 09 at 06:37 PM

    clearing the model value will do the job.

    accessing ui element usually is a bad idea.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 10 at 09:09 PM


    according to the documentation, setValue(null) restore the default value (

    Maybe you could try this.byId("fwdUserId").setValue("");

    I hope it's help



    Add comment
    10|10000 characters needed characters exceeded

  • Feb 10 at 07:36 AM

    Hi Jun Wu,

    I was not storing the value which is entered in the input area in any of the model. And values for my smart field are coming based on annotations from CDS Views.

    So is there any alternate way to clear the entered value from Smart field.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 12 at 06:12 AM

    Is your field is nullable in the metadata, if no make it nullable ?



    Add comment
    10|10000 characters needed characters exceeded