botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Wrong Fields are predefined from LuisResult

Open kevinport opened this issue 10 years ago • 4 comments

I've got one Entity defined, "Location".

In my BuildForm-Method i thought, that i have to write a ActiveDelegate to avoid that if the entity "Location" is filled, the user won't be asked for a location. fallacy

But this raised an "Error", because the Form wants to fill FieldA or FieldB or FieldC with my entity value. If i remove the "isNotFilled" ActiveDelegate the Form works fine and my Location-Field is filled with the entity value of "Location".

//new Code

.Field("Location")

//old Code

public static IForm BuildForm() { var builder = new FormBuilder(); ActiveDelegate isfilled = (myobject) => myobject.Location != string.Empty; ActiveDelegate isNotFilled = (myobject) => myobject.Location == string.Empty;

  return builder
     .Field("Location",isNotFilled )
      .Field("FieldA")
      .Field("FieldB")
      .Field("FieldC")

..... .Build() ;

Even if i made a logical mistake, entities mustn't fill Fields they don't belong to

kevinport avatar Aug 09 '16 16:08 kevinport

I'm not sure I understand your issue. Are you saying that your "Location" LUIS entity caused some other field to be filled?

You should not need to define an ActiveDelegate in this case. If you pass in an Entity to fill in the value, then the user should not be prompted for that field unless you specify FormOptions.PromptFieldsWithValues. (In that case the entity becomes the default value which can be confirmed or changed.)

chrimc62 avatar Aug 10 '16 00:08 chrimc62

Yes. If the ActiveDelegate disable the question for Location, the next field is filled with my entity "Location" from LUIS.

return builder .Field("Location",isNotFilled ) .Field("FieldA") .Field("FieldB") .Field("FieldC")

--> Now FieldA is filled with my Entity value "Location"

Now i know that i dont need to use a ActiveDelegat, but if i use a actiedelegate on a field which is predefined by an entity, no other field mustn't filled from it.

You can copy my code, Location is a string field.

kevinport avatar Aug 10 '16 04:08 kevinport

Thanks for the bug report--this will be fixed in the next release.

chrimc62 avatar Aug 11 '16 19:08 chrimc62

Thanks

kevinport avatar Aug 11 '16 19:08 kevinport