cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind data from ValueHelp to Simpleform?

jakir03
Explorer
0 Kudos
1,216

Hi Team,

I'm binded the data to F4 value help and I want to bind that Value Help data to my simple form. But I'm getting the error "setValue".

Could anyone give me the solution.

Regards,
Jakir

Error//

<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" controllerName="zthrift.zthriftt.controller.View1" displayBlock="true">
	<Shell id="shell">
		<App id="app">
			<pages>
				<Page id="page" title="{i18n>title}">
					<content>
						<VBox class="sapUiSmallMargin">
							<f:SimpleForm id="SimpleForm" editable="true" layout="ResponsiveGridLayout" title="{i18n>formtitle}" labelSpanXL="3" labelSpanL="3" labelSpanM="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleContainerFullSize="false">
								<f:content>
									<Label text="Employee Number"/>
									<Input id="input1" value="{Pernr}" showValueHelp="true" valueHelpRequest="onValueHelpRequest" />
									<Label text="Employee Name"/>
									<Input id="input2" value="{Vorna} {Nach2}"/>
									<Label text="Employee Joining Date"/>
									<Input id="input3" value="{Begda}"/>
									<Label text="Employee End Date"/>
									<Input id="input4" value="{Endda}"/>
									<Label text="Duration of Service"/>
									<DatePicker id="DP1" placeholder="Enter Date" change="handleChange" class="sapUiSmallMarginBottom" value="{Duration} {Zyear} {Zmonth} {Zday}"/>
									<Label text="Employee Contribution since 2021 (SAR)"/>
									<Input id="input5" value="{Value}"/>
									<Label text="Thrift Plan Contribution Recovery (SAR)"/>
									<Input id="input6" value="{Zcurr}"/>
								</f:content>
							</f:SimpleForm>
						</VBox>
					</content>
					<footer>
						<OverflowToolbar>
							<ToolbarSpacer/>
							<Button type="Accept" text="Calculate"/>
							<Button type="Emphasized" text="Print"/>
						</OverflowToolbar>
					</footer>
				</Page>
			</pages>
		</App>
	</Shell>
</mvc:View>

// controller.js

sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/ui/core/Fragment", "sap/ui/model/Filter", "sap/ui/model/FilterOperator" ], function (Controller, Fragment, Filter, FilterOperator) { "use strict"; return Controller.extend("zthrift.zthriftt.controller.View1", { onInit: function () { }, onValueHelpRequest: function (oEvent) { if (!this._DialogEmployee) { this._DialogEmployee = sap.ui.xmlfragment("zthrift.zthriftt.view.valueHelp", this); this.getView().addDependent(this._DialogEmployee); } jQuery.sap.syncStyleClass("sapUiSizeCompact", this.getView(), this._DialogEmployee); this._DialogEmployee.open(); }, _handleValueHelpConfirm: function (oEvent) { debugger; var oSelectedItem = oEvent.getParameter("selectedItem"); if (oSelectedItem) { var productInput = this.byId(this._sInputId); productInput.setValue(oSelectedItem.getTitle()); } oEvent.getSource().getBinding("items").filter([]); } }); });

//fragment.xml

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core"> <SelectDialog noDataText="No Records Found" title="Select Table" search="_handleValueHelpSearch" confirm="_handleValueHelpConfirm" cancel="_handleValueHelpClose" items="{/EmployeeF4HelpSet}"> <StandardListItem title="{Pernr}" description="{Rufnm} {Vorna} {Nach2}" type="Active"/> </SelectDialog> </core:FragmentDefinition>

Accepted Solutions (0)

Answers (2)

Answers (2)

jklimes
Explorer
0 Kudos

Hi Abdul,

looks like your this._sInputId is not set. I dont see it in code of your controller so maybe that is the problem. Otherwise the string in this._sInputId is bad and it cannot find the element with that Id.

junwu
Active Contributor
0 Kudos
this._sInputId  did you initialize this variable?

why can't you just debug?