In my Blazor Server-Side App, I have to call another website and submit a form. However, before the form can be submitted the app needs to do some local processing and based on the result submit the form or do not. How is this done?
My thought was to have a button that has @onclick and from that function call the form. Something like this:
<button @onclick="MyFunction">Click Me</button>
<form METHOD="POST" ACTION="https://someURL.com">
<input TYPE="hidden" NAME="value1" VALUE="@myValue1">
<input TYPE="hidden" NAME="value2" VALUE="@myValue2">
<input TYPE="SUBMIT" NAME="SUBMIT" class="btn btn-primary" style="margin: 5px" VALUE="Do stuff">
</form>
@code{
private void MyFunction()
{
if (AmazingLogicFunction())
//Code to click SUBMIT
}
}
However, I cannot seem to be able to get the element named SUBMIT
If I have to do it some other way I am fine with that.