I have a question about how to submit form data using hidden input fields when a user clicks on an <a>
tag.
<form action="/submit/form/link">
<input type="hidden" [attr.value]="orderNumber.id" />
<input type="hidden" [attr.value]="orderNumber.country" />
<a>start order process</a>
</form>
I am looking for a way to achieve this functionality because I haven't been able to find any examples of submitting a form with an <a>
tag. While I know that I can use <input type="submit" />
or
<button type="submit">submit</button>
, I specifically need to make it work with an <a>
tag in this case.
One solution I have considered is using the (click)
attribute in the <a>
tag to trigger a function in my .ts
file, like so:
<a (click)="startOrderProcess()">start order process</a>
However, I still need guidance on programmatically submitting the form with the hidden input data to redirect to the specified action link (/submit/form/link
) from my .ts
file. Can anyone provide insights on how to accomplish this?