Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I need to use some java script validation in one of my form. Below is the form coding. I am using surface controller in MVC.
So once i click on submit button (Customer Checkout), it will check "First Name" is entered or not. If not entered then it should no submit the form.
If there is a simple webform then i can do this easily but don't know how to do it with BeginUmbracoForm. Please help me here ?
@using (Html.BeginUmbracoForm("CheckOutCustomerOverview", "CustomerSurface", FormMethod.Post)) { @*<script type="text/javascript" language="javascript"> function validateForm(formElement) { if(formElement.billingFirstnames.Length <= 0) { alert('Please enter First Name'); return false; } } </script>*@ <table class="formTable"> <tr> <td class="fieldLabel"> First Name(s): </td> <td class="fieldData"> <input name="billingFirstnames" id="billingFirstnames" type="text" maxlength="20" value="" style="width: 200px;"> </td> </tr> <tr> <td> <input type="submit" value="Customer Checkout" onclick="return validateForm(this.form)" /> </td> </tr> </table> }
Looks like it should work OK except in JavaScript "length" is lowercase.
Andy
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
execute java script validation with BeginUmbracoForm methods
Hi
I need to use some java script validation in one of my form. Below is the form coding. I am using surface controller in MVC.
So once i click on submit button (Customer Checkout), it will check "First Name" is entered or not. If not entered then it should no submit the form.
If there is a simple webform then i can do this easily but don't know how to do it with BeginUmbracoForm. Please help me here ?
Looks like it should work OK except in JavaScript "length" is lowercase.
Andy
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.