Validiate before subbmiting for

Hi All ,

I want to display the slots filled by user in form actions and ask confirmations before submitting the form ,

for example

utter_confirm_leave_applications:

  • text: Your {leave_type} from {from_date} till {to_date} is correct ?
  • affirm
  • submit form

of deny restart the form

thank you

Hi @Aashay1

Add one more slot to your form(and domain). You can name it to something like confirmMyFormName.

your utter_ask_confirmMyFormName text should be “Your {leave_type} from {from_date} till {to_date} is correct ?”

Then you validate the slot (if users intent is not affirm it will restart the form):

def validate_confirmMyFormName(
     self,
     value: Text,
     dispatcher: CollectingDispatcher,
     tracker: Tracker,
     domain: Dict[Text, Any],
 ) -> Dict[Text, Any]:
     """Validate slot value."""

intent = tracker.latest_message['intent'].get('name')

if intent == 'affirm'
    return {"confirmMyFormName": value}
else:
    return [SlotSet('leave_type', None), SlotSet('from_date', None), SlotSet('to_date', None), SlotSet('confirmMyFormName', None)]

Hey @k1m,

Thankz for the reply , I’ll surely try out this option

hi @k1m,

"Failed to extract slot confirm_apply_leave with action apply_leave_form "

i am getting this error

thank you

Try this slot mapping:

 def slot_mappings(self):
        # type: () -> Dict[Text: Union[Dict, List[Dict]]]
        return {"confirm_apply_leave": [self.from_text()]
        }

yes its working fine not thak you ,