I have a form which submits a value. When the user tries to submit the form I want to display an alert conformation box. Upon clicking OK
, the value should be saved but if Cancel
is clicked instead the form should display but not save the data.
@using (Html.BeginForm())
{
@Html.TextBoxFor(model => model.MobileNo)
<input type="submit" name="name" value="Save" />
}
@using (Html.BeginForm())
{
@Html.TextBoxFor(model => model.MobileNo)
<input type="submit" name="name" value="Save" onclick="return confirm('Are you sure?')" />
}
You can use confirm() of javascript in onclick of the button with return.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments