Trying to trigger form using useRef and forward Ref
Answered
Crème D’Argent posted this in #help-forum
Crème D’ArgentOP
I yearn to remotely engage this form, either through simulating a button press or utilizing a direct form reference.
https://gist.github.com/hossam1231/2e5e991b2c78a70800ecf10e9bb22a69
https://gist.github.com/hossam1231/21a401f693fc56e01dd0f24e0f61a47e
https://gist.github.com/hossam1231/2e5e991b2c78a70800ecf10e9bb22a69
https://gist.github.com/hossam1231/21a401f693fc56e01dd0f24e0f61a47e
Answered by sabin
What is the reason for trying to have the submit button outside of the form element? Ideally, we should always place the button within the form.
I think you can achieve this by referencing the form id:
I think you can achieve this by referencing the form id:
<form id="createIncidentForm">
</form>
<button type="submit" form="createIncidentForm">Create</button>
6 Replies
What is the reason for trying to have the submit button outside of the form element? Ideally, we should always place the button within the form.
I think you can achieve this by referencing the form id:
I think you can achieve this by referencing the form id:
<form id="createIncidentForm">
</form>
<button type="submit" form="createIncidentForm">Create</button>
Answer
Crème D’ArgentOP
thank you il give this a try
this is because my form element is from within the page however my submit button is within my layout
Crème D’ArgentOP
splendid this has worked like a charm thanks a million
ahaha turns out when you skip to react you miss all these handy things like id
Haha, yeah, always master the fundamentals 🙂