Authors:
Cameron Johns, Cille Schliebitz, Anita Gu
Changed on:
3 Feb 2025
`onChange` event provided by the `FormFieldProps` to pass the structured data (containing `locationRef` and `quantity`) back to the form. This ensures that the user's input is included in the data posted when the form is submitted. We'll also demonstrate how to verify the output using browser developer tools.`onChange` Event: The onChange event of FormFieldProps is used to pass the data back to the form.`StockReservationPayload`: The output data is structured according to the StockReservationPayload interface, containing `locationRef` and `quantity`.`onChange` Call: The `onChange` event is called only when a valid location is selected.`reservationDetails` attribute.`useEffect` hook and call the `onChange` event defined on the `FormFieldProps` component.`FormFieldProps` to use the `StockReservationPayload` interface, this expects a `locationRef` and a `quantity` as part of the complex object value.`onChange` should only be called if a valid value is selected for the location state variable.`reservationDetails` event attribute to see the result.