Form in a modal box is not posting on submiit - forms

I have a contact form in a modal box and a php file to process the data and send it as an email.
For the life of me I can't get the modal to send any information - it just closes as if nothing happened.
Here is the modal box code
<div id="quoteme" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="boxmod">
<div class="row">
<div class="modal-body">
<div class="col-sm-8 col-sm-offset-2 text-center bfh-form-modal">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
<form id="myForm" action="" method="POST" action="formtest.php">
<h1>Quick Quote</h1>
<p>Contact us today, and get a reply with in 24 hours!</p>
<fieldset>
<input class="monicker" name="name" placeholder="Your name" type="text" tabindex="1" required>
</fieldset>
<fieldset>
<input placeholder="Your Email Address" name="email" type="email" tabindex="2" required>
</fieldset>
<fieldset>
<input placeholder="Your Phone Number" name="telnum" type="tel" tabindex="3" required>
</fieldset>
<fieldset>
<input placeholder="Your Web Site starts with http://" name="userurl" type="url" tabindex="4" required>
</fieldset>
<fieldset>
<textarea placeholder="Type your Message Here. To save time, please include as much detail as possible about the work you wish us to quote on." name="comments" tabindex="5" required></textarea>
</fieldset>
<fieldset>
<input name="submitbutton" type="submit" id="contact-submit" data-submit="...Sending" value="Submit"></input>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
What am I missing to make this send information to formtest.php?

Related

FormSubmit.co is redirecting to an infinite (presumably) loading screen

Whenever I try sending an email through an email form I made, it redirects me to another page that keeps loading for several minutes. After a random amount of time (from minutes, to even days), I get the email I sent.
I'm not sure why this is happening and have not yet found a solution. This is my code for the form:
<div class="mail">
<h1 style="font-size: 50px;">Contact Us</h1>
<form target="_blank" action="https://formsubmit.co/xxxx#gmail.com" method="POST">
<div class="form-group">
<input type="hidden" name="_template" value="table">
<div class="form-row">
<div class="col">
<input type="text" name="name" class="form-control" placeholder="Full Name" required>
</div>
<div class="col">
<input type="email" name="email" class="form-control" placeholder="Email Address" required>
</div>
</div>
</div>
<div class="form-group">
<textarea placeholder="Your Message" class="form-control" name="message" rows="10" required></textarea>
</div>
<button type="submit" class="btn btn-lg btn-dark btn-block">Submit Form</button>
</form>

Form Submit - Open New Tab at same time

I have a contact form on my website. I'm using a free bootstrap template that I've been editing and configuring because I don't know much about coding.
I want a new tab to open and go to a specific website when the user hits the submit button (so both submit the form, and take them to a new web page). How can I do that?
<form name="sentMessage" id="contactForm" target="blank" novalidate>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Name *" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="email" class="form-control" placeholder="Your Email *" id="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="tel" class="form-control" placeholder="Your Phone *" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<div class="clearfix"></div>
<br><br>
<div class="col-lg-12 text-center">
<div id="success"></div>
<button type="submit" class="btn btn-xl">Send Message</button>
</div>
</div>
</form>
You just need to add in the
action="/newpage.php" method="post"
so in your example, it would look like:
<form name="sentMessage" id="contactForm" action="/newpage.php" method="post" novalidate>
Hope that helps... Note the /newpage is the page (wherever it is) which will process your POST request.
Please use the javascript like this.
then will open new tab as you said
function func1(){
window.open('https://google.com', '_blank');
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form name="sentMessage" id="contactForm" onsubmit="func1()" novalidate>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Name *" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="email" class="form-control" placeholder="Your Email *" id="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="tel" class="form-control" placeholder="Your Phone *" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<div class="clearfix"></div>
<br><br>
<div class="col-lg-12 text-center">
<div id="success"></div>
<button type="submit" class="btn btn-xl">Send Message</button>
</div>
</div>
</form>
And also you can add action property to form tag.
then if you click the button then will open the new tab as your request, and then will send request to file you specified in action property.
if your purpose is only to open new tab, and don't need to submit form, then please add
return false
at the end of func1 function in my code

Bootstrap submit button won't work

I have the below code where I'm trying to submit data from a form into my back-end. Whenever I press the button it doesn't do anything and it's supposed to route to the specified place. I have looked at several examples and still hasn't worked. Below is my form. Any suggestions?
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4 text-center">
<h1>Sign Up</h1>
<form action ="/adduser" method="POST" id="adduser">
<fieldset class="form-group">
<label for="InputUsername"> Username </label>
<input type="text" class="form-control" name="username" id="InputUsername" placeholder="Enter username">
</fieldset>
<fieldset class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" name="email"id="exampleInputEmail1" placeholder="Enter email">
<small class="text-muted">We'll never share your email with anyone else.</small>
</fieldset>
<fieldset class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" name="password"id="exampleInputPassword1" placeholder="Password">
</fieldset>
<button class="btn btn-default" form="signup" type="submit">Sign up</button>
</form>
</div>
</dv>
</div>
Here is my route
#app.route('/adduser', methods=["POST"])
def adduser():
print(request.form, file=sys.stderr)
username = request.form['username']
password = request.form['password']
email = request.form['email']
models.User.create_user(email, password, username)
login_user(user)
return redirect_url('index.html')
Your button has a form attribute of signup but your form has an id of adduser, so the button does not belong to the form. Try changing these values to match.

I cant get my mailto contact form to work

I have tried to make a contact form in a modal window. I thought I had done everything correctly but when I click send, I don't receive the email. Can anybody please show me where I'm going wrong?
Thanks very much in advance. Merry Xmas!
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Contact McGregor Beauty</h3>
</div>
<div class="modal-body">
<form id="contact" method="post" action="mailto:aka_pipsqueak#msn.com">
Your Name <input class="input-xlarge" type="text" placeholder="Please write your name here" required>
<br />
Your Email <input class="input-xlarge" type="email" placeholder="Please enter your email address here" required><br />
Phone(Optional) <input class="input-large" type="number" placeholder="Add a telephone number"><hr />
<label><strong>Treatments of Interest</strong></label>
<label class="checkbox">
<input type="checkbox" value="Waxing & Tinting">Waxing & Tinting
</label>
<label class="checkbox">
<input type="checkbox" value="Massage">Massage
</label>
<label class="checkbox">
<input type="checkbox" value="Reflexology">Reflexology
</label>
<label class="checkbox">
<input type="checkbox" value="Manicure/Pedicure">Manicure & Pedicure
</label>
<label class="checkbox">
<input type="checkbox" value="MLD">MLD
</label>
<br />
<label><strong>Your Questions/Comments</strong></label>
<textarea rows="2" style="width:500px" type="text" required></textarea>
<div class="modal-footer">
<button class="btn btn-primary" type="submit" data-dismiss="modal" aria-hidden="true">Send</button>
</div>
</form>
what mail server are you using?
where is the server side code used to handle the http request of the form?
Just having a form in html isn't going to do anything, and an action of mailto: is not correct, nor would you want to do this because this email address can be seen in the markup and will be spammed until you close it.
what programming language are you planning to use?
Here's a basic example you can follow using php:
http://www.w3schools.com/php/php_mail.asp

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" />