Whats wrong with my contact form? - forms

Could someone please take a look at my website's code and tell me why my contact form isnt working?
Here are the relevant portions of code:
From the contact.html file:
<h3 class="indent-bot2">Contact Form</h3>
<form action="#" id="contact-form">
<div class="success"> Contact form submitted!<br>
<strong>We will be in touch soon.</strong> </div>
<fieldset>
<label class="name">
<input type="text" value="Enter Your Name:">
<span class="error">*This is not a valid name.</span>
<span class="empty">*This field is required.</span> </label>
<label class="email">
<input type="text" value="Enter Your E-mail:">
<span class="error">*This is not a valid email address.</span>
<span class="empty">*This field is required.</span> </label>
<label class="phone">
<input type="tel" value="Enter Your Phone:">
<span class="error">*This is not a valid phone number.</span>
<span class="empty">*This field is required.</span> </label>
<label class="message">
<textarea>Enter Your Message:</textarea>
<span class="error">*The message is too short.</span>
<span class="empty">*This field is required.</span> </label>
<div class="buttons-wrapper">
<a class="button" data-type="reset">Clear</a>
<a class="button" data-type="submit">Send</a>
</div>
</fieldset>
</form>
Also from the contact.html file:
<script type="text/javascript">
$(window).load(function(){
$('.slider')._TMS({
duration:800,
easing:'easeInCirc',
preset:'zabor',
pagination:false,
slideshow:7000,
banners:'fromTop',
nextBu:'.next',
prevBu:'.prev',
waitBannerAnimation:false,
pauseOnHover:true,
beforeAnimation:function(){
$('.slider .prev')
.stop()
.animate({top:'425px'},300,'easeOutCirc')
$('.slider .next')
.stop()
.animate({top:'425px'},300,'easeOutCirc')
},
afterAnimation:function(){
$('.slider .prev')
.css({top:'425px'})
.stop()
.animate({top:'327px'},300,'easeOutCirc')
$('.slider .next')
.css({top:'425px'})
.stop()
.animate({top:'327px'},300,'easeOutCirc')
}
})
$('#contact-form').forms({
ownerEmail:'info#dohatutor.com'
})
});
</script>
I think this is the piece of code that links to a javascript file which in turn calls "mailhandler.php".

<form action="some script" METHOD="POST" ENCTYPE="multipart/form-data"></form>
action="php or asp or pl script for processing form"

You didn't specify where the form should post to - what is the name of the script that you want to post this form to?
Now it says:
form action="#"
And it should say something like:
form action="contact.php"

Related

Html Form inside another form not redirecting to the correct URL

I've the following form on JSP:
<form class="form-horizontal" style="margin-bottom: 24px">
<fieldset id="myFieldset" disabled>
<div class="form-group">
<label class="control-label col-sm-3" style="text-align: left">Created By</label>
<div class="col-sm-4">
<input class="form-control" type="text" name="created_by" value="${inputConfiguration.getCreatedBy()}" readonly/>
</div>
</div>
.
.
. few more divs of form-group
.
.
</fieldset>
<div class="form-group row">
<div class="col-sm-offset-4">
<form action="${pageContext.request.contextPath}/Configuration/EditConfiguration" method="GET">
<input type="hidden" name="marketplace" value="${param.marketplace}">
<input type="hidden" name="program" value="${param.program}">
<button class="btn btn-primary"> form_Edit </button>
</form>
</div>
<div class="col-sm-1">
<form action="${pageContext.request.contextPath}/Configuration/CopyConfiguration" method="GET">
<input type="hidden" name="marketplace" value="${param.marketplace}">
<input type="hidden" name="program" value="${param.program}">
<button class="btn btn-primary"> form_Copy to New </button>
</form>
</div>
</div>
</form>
However, the forms that are within the outer-form are not redirecting to the correct path on clicking their respective buttons. NOTE: the hidden input fields are just to pass them as url parameters to the paths mentioned in the action and nothing else. Can anyone suggest as to how to pass these as url params and how to make the nested forms work?

Enable autocomplete when using Hosted Payment Fields

I'm wondering if it's possible to enable autocomplete of a credit card stored in the browser, for example using simple html, the browser shows option to autocomplete stored credit card details.
<form method="post" id="usrForm">
<h4>Do not use a real card</h4>
<label for="nameoncard">Name on Card</label>
<input type="text" id="nameoncard" name="nameoncard" autocomplete="cc-name">
<label for="ccnumber">Credit Card Number</label>
<input type="text" id="ccnumber" name="ccnumber" autocomplete="cc-number">
<label for="cc-exp-month">Expiration Month</label>
<input type="number" id="cc-exp-month" name="cc-exp-month" autocomplete="cc-exp-month">
<label for="cc-exp-year">Expiration Year</label>
<input type="number" id="cc-exp-year" name="cc-exp-year" autocomplete="cc-exp-year">
<label for="cvv2">CVV</label>
<input type="text" id="cvv2" name="cvv2" autocomplete="cc-csc">
<input type="submit" value="Submit" name="submit">
</form>
We are using a form with Hosted payment fields, something like that:
<div class="panel panel-default bootstrap-basic">
<form class="panel-body" action="your-form-handling-page" method="POST" id="checkout-form" onsubmit="return do_when_clicking_submit_button()">
<div class="row">
<div class="form-group col-md-12">
<label for="cardholder-name">Name on Card</label>
<input type="text" class="form-control" id="cardholder-name" placeholder="Full Name">
<span class="helper-text"></span>
</div>
<!--Hosted Field for CC number-->
<div class="form-group col-md-12">
<label for="card-number">Card Number</label>
<div class="input-group">
<div class="form-control" id="card-number" data-bluesnap="ccn"></div>
<div id="card-logo" class="input-group-addon"><img src="https://files.readme.io/d1a25b4-generic-card.png" height="20px"></div>
</div>
<span class="helper-text" id="card-help"></span>
</div>
<!--Hosted Field for CC EXP-->
<div class="form-group col-xs-7">
<label for="exp-date">Exp. Date</label>
<div class="form-control" id="exp-date" data-bluesnap="exp"></div>
<span class="helper-text"></span>
</div>
<!--Hosted Field for CC CVV-->
<div class="form-group col-xs-5">
<label for="cvv">Security Code</label>
<div class="form-control" id="cvv" data-bluesnap="cvv"></div>
<span class="helper-text"></span>
</div>
</div>
<button class="btn btn-success btn-lg col-xs-6 col-xs-offset-3" type="submit" id="submit-button">Pay Now</button>
</form>
</div>
<!--BlueSnap Hosted Payment Fields JavaScript file-->
<script type="text/javascript" src="https://sandbox.bluesnap.com/services/hosted-payment-fields/v1.0/bluesnap.hpf.mini.js"></script>
It would be awesome if there would be a way so that browsers suggests autocomplete.
Am I missing something obvious here? Any help would be greatly appreciated.
I work for BlueSnap. Unfortunately the Hosted fields themselves have autocomplete disabled so this will not work no matter what you add to the divs in your client code (if you inspect the field you will see autocomplete="off") . I have opened a bug in our system to support this since I can see why it's an important feature to have. Thanks for posting this.

Form is submitting and redirecting without information

I'm really terrible with forms, so any help you can provide would be great.
This form initially had a modal that came up on submission, but I had to change it to a redirect. Now it's redirect without any data being entered.
<form id="contact-form" method="post" onsubmit="return redirect()">
<div class="contact-form-loader"></div>
<fieldset>
<div class="contact-form_top-section">
<label class="name">
<input type="text" name="name" placeholder="Parent's Name:" value="" data-constraints="#Required #JustLetters">
<span class="empty-message">*This field is required.</span>
<span class="error-message">*This is not a valid name.</span>
</label>
<label class="email">
<input type="text" name="email" placeholder="Parent's E-mail:" value="" data-constraints="#Required #Email">
<span class="empty-message">*This field is required.</span>
<span class="error-message">*This is not a valid email.</span>
</label>
<label class="phone">
<input type="text" name="phone" placeholder="Parent's Cellphone:" value="" data-constraints="#JustNumbers">
<span class="empty-message">*This field is required.</span>
<span class="error-message">*This is not a valid phone.</span>
</label>
<label class="message">
<input type="text" name="message" placeholder="Tell us about your children:" value="" data-constraints="#Required">
<span class="empty-message">*This field is required.</span>
<span class="error-message">*The message is too short.</span>
</label>
</div>
<div class="contact-form_bottom-section">
Clear
<input type="submit" class="btn btn__hover bg-color-6" value="Send">
</div>
</fieldset>
The .js page has a ton of data, and I'm not exactly sure which part you need. Here's the first part.
;(function($){
$.fn.TMForm=function(opt){
return this.each(TMForm)
function TMForm(){
var form=$(this)
opt=$.extend({
okClass:'ok'
,emptyClass:'empty'
,invalidClass:'invalid'
,successClass:'success'
,responseErrorClass:'response-error'
,responseMessageClass:'response-message'
,processingClass:'processing'
,onceVerifiedClass:'once-verified'
,mailHandlerURL:'bat/MailHandler.php'
,successShowDelay:'4000'
,stripHTML:true
,recaptchaPublicKey:''
,capchaTheme:'clean'
},opt)
init()
function init(){
form
.on('submit',formSubmit)
.on('reset',formReset)
.on('focus','[data-constraints]',function(){
$(this).parents('label').removeClass(opt.emptyClass)
})
.on('blur','[data-constraints]:not(.once-verified)',function(){
$(this)
.addClass(opt.onceVerifiedClass)
.trigger('validate.form')
})
.on('keyup','[data-constraints].once-verified',function(){
$(this).trigger('validate.form')
})
.on('keydown','input',function(e){
var $this=$(this)
,next=$this.parents('label').next('label').find('input,textarea')
if(e.keyCode===13)
if(next.length)
next.focus()
else
form.submit()
})
.on('keydown','textarea',function(e){
if(e.keyCode===13&&e.ctrlKey)
$(this).parents('label').next('label').find('input,textarea').focus()
})
.on('change','input[type="file"]',function(){
$(this).parents('label').next('label').find('input,textarea').focus()
})
.attr({
method:'POST'
,action:opt.mailHandlerURL
})
Your best bet is to put the redirect function at the end of the formSubmit function which should be somewhere in your JS file. By doing what you did your form never gets to hit the 'formSubmit' function which I assume handles the data.

Form submit from Bootstrap 3 and JSP get parameter

I'm new to Bootstrap. But I'm pretty familiar with HTML. The thing is I cannot get parameter values from JSP. The parameters are from HTML page with Bootstrap 3. Here're the code. I don't understand. If I make simple html only page, then I could get the parameters.
<form class="form-horizontal" method="POST" action="makeResv.jsp">
<div class="container">
<div class="row">
<div class="control-group col-md-5">
<label for="checkIn">date1</label>
<div id="date-container">
<div class="input-group date">
<input type="text" id="checkIn" class="form-control"><span
class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
<div class="control-group col-md-5">
<label for="checkOut">date2</label>
<div id="date-container">
<div class="input-group date">
<input type="text" id="checkOut" class="form-control"><span
class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-success">search</button>
</div>
</div>
</div>
</form>
In a JSP page, I'm just doing the following.
String checkIn = request.getParameter("checkIn");
String checkOut = request.getParameter("checkOut");
out.println(checkIn + " " + checkOut);
What's wrong with the above HTML code with Bootstrap?? Please give me some advise. Thanks!!
BTW, I'm using datepicker JavaScript library, but I don't think that affect the results. I cannot add the library code here but it works great anyway.
https://github.com/eternicode/bootstrap-datepicker
Bootstrap is same as HTML. The problem you are having is because you do not have any name attribute defined in your input element. You define id but to access submited variables via POST (request.getParameter() function) you need to have name attribute defined:
Replace <input> lines like this:
<input type="text" name="checkIn" id="checkIn" class="form-control">
And
<input type="text" name="checkOut" id="checkOut" class="form-control"><

HTML form not sending parameters

I wrote a login panel for my website and everything looks fine but when I click on submit page refreshes and no parameters are being sent. I checked both get andpost methods but it's not working. here is my code:
<form id="login_form" action="index.php?task=login" method="post">
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input class="span2" id="username" type="text" value="Username" onblur="if(this.value=='') this.value='Username'" onfocus="if(this.value=='Username') this.value='';">
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-cog"></i></span>
<input class="span2" id="password" type="password" value="Password" onblur="if(this.value=='') this.value='Password'" onfocus="if(this.value=='Password') this.value='';" />
</div>
</div>
</div>
<div class="clear"></div>
<div class="separator"></div>
<button type="submit" class="btn">Login</button>
</form>
Can anyone tell me what is wrong with my code?
Your input tags don't have the name attribute which is required to post the value.
<input type="text" name="username" />