And to prevent the submission form

Conditions: .netcore web mvc

In view View interface, a new form button to perform tasks --- we need the data submitted. But in some cases we usually do not need to submit the form, for example: a simple registration interface, fill out the information when we need two buttons, one for the OK button, a Cancel button is, but if you simply deal with this, then there will be problems when you click the cancel button when the form is submitted also to go back, but here we do not want it to be submitted to the background. So at this time we need to make some simple actions to deal with the problem submit the form;

Without further ado directly on the code:

     Controller code:     

            

    View code:

            

  

 

     Please refer to the full project code: https://github.com/gamecc666/FormSubmissAndPrevent

 

     Disclaimer: This article is a blogger original article, if reproduced, please indicate the source.

Guess you like

Origin www.cnblogs.com/gamecc666/p/11113254.html