<form action="/Plugin/Ajax/ContactUs" class="form-horizontal" id="contact-form" method="post" name="contact-form"> <div class="col-sm-6">
|
| <div class="form-group">
|
| <div class="col-sm-12">
|
| <input class="validate[required] form-control" id="FullName" name="FullName" placeholder="Name" size="30" type="text" value="" />
|
| <label id="lblName" name="lblName" class="errorlbl"></label>
|
| </div>
|
| </div>
|
| <div class="form-group">
|
| <div class="col-sm-12">
|
| <input class=" validate[required,custom[email]] form-control" id="ContactEmail" name="ContactEmail" placeholder="Email" size="30" type="text" value="" />
|
| <label id="lblEmail" name="lblEmail" class="errorlbl"></label>
|
| </div>
|
| </div>
|
| <div class="form-group">
|
| <div class="col-sm-12">
|
| <input class="validate[required] form-control" id="ContactNumber" name="ContactNumber" placeholder="Mobile" size="30" type="text" value="" />
|
| <label id="lblContactNumber" name="lblContactNumber" class="errorlbl"></label>
|
| </div>
|
| </div>
|
| </div>
|
| <div class="col-sm-6">
|
| <div class="form-group">
|
| <div class="col-sm-12">
|
| <textarea class="validate[required] form-control" cols="20" id="ContactMessage" name="ContactMessage" placeholder="Message" rows="7" width="100%">
|
| </textarea>
|
| <label id="lblContactMessage" name="lblContactMessage" class="errorlbl"></label>
|
| </div>
|
| </div>
|
| <div class="my_contactbtn">
|
| <button id="btnContact" class="btn my_contactsubmit" name="btnFeedback">Submit</button>
|
| <p style="display:inline;"><span id="contact-msg" class=""></span></p>
|
| </div>
|
|
|
| </div>
|
| </form>
|
<script type="text/javascript">
|
| $(function () {
|
| $("#ContactNumber").keydown(function (e) {
|
| // Allow: backspace, delete, tab, escape, enter and .
|
| if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190, 107]) !== -1 ||
|
| // Allow: Ctrl+A
|
| (e.keyCode == 65 && e.ctrlKey === true) ||
|
| // Allow: home, end, left, right
|
| (e.keyCode >= 35 && e.keyCode <= 39)) {
|
| // let it happen, don't do anything
|
| return;
|
| }
|
| if ($(this).val().length >= 10) {
|
| return false;
|
| }
|
| // Ensure that it is a number and stop the keypress
|
| if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
|
| e.preventDefault();
|
| }
|
| });
|
| });
|
| $(document).ready(function () {
|
| //Header
|
| $("#btnContact").click(function (e) {
|
| e.preventDefault();
|
|
|
| if ($("#FullName").val() == '') {
|
| $("#lblName").text("Please fill Full Name");
|
| $("#FullName").focus();
|
| return false;
|
| }
|
| else {
|
| $("#lblName").text("");
|
| }
|
|
|
| if ($("#ContactEmail").val() == '') {
|
| $("#lblEmail").text("Please fill Full Name");
|
| $("#ContactEmail").focus();
|
| return false;
|
| }
|
| else {
|
| $("#lblEmail").text("");
|
| }
|
|
|
| if ($("#ContactNumber").val() == '') {
|
| $("#lblContactNumber").text("Please fill Full Name");
|
| $("#ContactNumber").focus();
|
| return false;
|
| }
|
| else {
|
| $("#lblContactNumber").text("");
|
| }
|
|
|
|
|
| if ($("#ContactMessage").val() == '') {
|
| $("#lblContactMessage").text("Please fill Full Name");
|
| $("#ContactMessage").focus();
|
| return false;
|
| }
|
| else {
|
| $("#lblContactMessage").text("");
|
| }
|
|
|
|
|
|
|
| $.ajax({
|
| url: '/Ajax/ContactUs',
|
| data: $('#contact-form').serialize(),
|
| type: 'POST'
|
| })
|
| .done(function (data) {
|
| if (data.IsSuccess) {
|
| $('#contact-msg').html(data.Message).addClass('col-sm-12 control-label success');
|
| $('#contact-form').find("input[type=text], textarea").val("");
|
| }
|
| else {
|
| $('#contact-msg').html(data.Message).addClass('col-sm-12 control-label error');
|
| }
|
| $('#btnContact').val('Submit');
|
| })
|
| .fail(function (err) {
|
| $('#contact-msg').html('Failed To Perform Action. Please Try Again.').addClass('col-sm-12 control-label error');
|
| $('#btnContact').html('Connect');
|
| });
|
| //return false;
|
| });
|
|
|
|
|
| });
|
| </script> |