Closed talyh closed 6 years ago
Hey @talyh as far as I know the form component is critical for the rating form - that's where we hook with the handleSubmit method.
@talyh I see that the handleSubmit method can be called via the button, yes it should work - however, my concern is that we should use form to handle a form submission - which is semantically correct.
I think what we can do here is to keep the form wrapper, use your button component and change the type of that button to "submit". Do you think that would work?
<Button type="submit" >Submit</Button>
P.S. Sorry I edited your comment by mistake...
@stephanie56 - I replaced the div
wrapper back with form
, but left the Button as is. The <Button type="submit">
didn't work straight away (maybe because underneath it we have a React-Bootstrap button, maybe some other reason), so not sure we want to spend time researching it/changing it. Right now, as I understand it, it'd only affect where the submission is called from (the form
or the Button
).
Tentative behaviour of disabling the button until we get direction from Purvi on desired behaviour.
Modified RatingForm to use our Button component and added validation to it.
NOTE: I believe the Button should actually belong to the parent component, as it submits the whole thing (location + emoji). Didn't want to change it without input from the team, though, as it could imply a bigger change, affecting components other people may be working on. NOTE: I believe the
<form>
wrapper for the RatingForm is no longer needed, so replaced it with a simpler<div>
wrapper. We can restore it if needed. NOTE: I believe the e.preventDefault() in the doSubmission function is no longer needed, so commented it out. We can restore if there's still a reason for it.