0

I'm trying to get value from input and put it into my variable in controller but all the time it returns " Unable to get property 'getValue' of undefined or null reference ". How should i do that?

My popover fragment:

<core:FragmentDefinition 
xmlns="sap.m" 
xmlns:core="sap.ui.core">
<Popover showHeader="false" contentWidth="240px" contentHeight="350px" placement="Top">
    <NavContainer id="navConImage">
        <Page id="reserve" showNavButton="true" navButtonPress="onPopNavBack" title="Reserve">
            <Input placeholder="data" id="userData"/>
            <Button type="Accept" text="Accept" press="onAcceptRoomReservation">
                        <layoutData>
                            <OverflowToolbarLayoutData moveToOverflow="false" />
                        </layoutData>
                    </Button>
        </Page>
    </NavContainer>
</Popover>

my controller:

onAcceptRoomReservation: function(oEvent) {

        var user = this.getView().byId("userData").getValue();
        console.log(tab);
    },
codesyntax
  • 33
  • 1
  • 3
  • 6

1 Answers1

0

The way i solved it was:

var user = sap.ui.core.Fragment.byId("idOfNavContainer", "userData").getValue();
codesyntax
  • 33
  • 1
  • 3
  • 6