cancel
Showing results for 
Search instead for 
Did you mean: 

LiveChange not working in ValueHelp field

former_member1129777
Participant
0 Kudos

Hi All,

Am trying to use setValueState("None") on the VH field while mandatory validation. I am using Livechange function, but valuestate None is not working as i am not typing any key physically i get the value from VH dialog. So "LiveChange" is not working here. So can anyone help me to where how can i set the ValueState property depending on the values entered in VH field.

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

if(this.byId(ValueHelpId).getTokens().length > 0 )

   {

   this.byId(ValueHelpId).setValueState(sap.ui.core.ValueState.None);

   }else{

   this.byId(ValueHelpId).setValueState(sap.ui.core.ValueState.Error);

}

former_member1129777
Participant
0 Kudos

DO i need to write this under "liveChange".

former_member1129777
Participant
0 Kudos

i need to validate the VH in Fiori app.

santhu_gowdaz
Active Contributor
0 Kudos

i'm assuming you are using sap.m.multiinput.

check out these methods-JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.m.MultiInput

former_member1129777
Participant
0 Kudos

liveChange="onChange"

onChange: function() {

  if(this.getView().byId("id").getTokens().length > 0)

  {

  this.getView().byId("id").setValueState("None");

  }

  else

  {

  this.getView().byId("id").setValueState("Error");

  }

   },

I have above code written, but its not working when i try to select the value for VH from select Dialog. But if try to press tab / any key inside the VH field, this works.

but as per my requirement the user will not type / press any key , he will directly click on VH dialog to get the value. Once the user selects the value from VHDialog the ValueState should be None.

With out any key press I need to change the ValueState property.

Thanks,

Lakshmi

santhu_gowdaz
Active Contributor
0 Kudos

make valueHelpOnly=true in your multiinput.

former_member1129777
Participant
0 Kudos

<Input id="id" type="Text" liveChange="onChange"  showValueHelp="true" valueHelpRequest="ValueHelp">

This is the code I have used, in XML view. Fiori App

santhu_gowdaz
Active Contributor
0 Kudos
<Input change="onChange"  showValueHelp="true" valueHelpOnly=true valueHelpRequest="ValueHelp"/>
former_member1129777
Participant
0 Kudos

have changed <input> to <MultiInput> but not working.

Change event is not firing.

santhu_gowdaz
Active Contributor
0 Kudos

Sorry use this in your method,

if(this.byId(ValueHelpId).getValue() !== "" )

   {

   this.byId(ValueHelpId).setValueState(sap.ui.core.ValueState.None);

   }else{

   this.byId(ValueHelpId).setValueState(sap.ui.core.ValueState.Error);

}

former_member1129777
Participant
0 Kudos

Thanks a ton for the help.

Answers (0)