Bootstrap submit button won't work - forms

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.

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>

using the form template in bootstrap for styling only

can I use only the layout of the form in bootstrap and have the input option frozen and the submit buttons behave like plain html button which redirects somewhere?
Why I want this?
So in the homepage I have resources which can be deleted pressing the delete button against them. On clicking the delete button the resource data is displayed like the layout of a form, of course I want typing inputs to be disabled, and a warning message on top, and YES and RESET option at the bottom. Since the form has a specific action assigned via GET method it will invariably perform that action irrespective of the choice selected. So if RESET is also selected the resource still gets deleted.
One option is to have the buttons as individual links with specific redirection properties but then I need to handcode the entire styling of the form.
Below is the code
#elseif($layout=='delete')
<div class="container-fluid mt-4">
<div class="row">
<section class="col md-7">
<div class="card mb-3">
<img src="https://cdn.pixabay.com/photo/2014/05/05/19/53/keyboard-338502_1280.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Are you sure you want to delete</h5>
<form action="{{url('/destroy/'.$student->id)}}" method="get">
#csrf
<div class="form-group">
<label>CNE</label>
<input value="{{ $student->cne }}" type="text" class="form-control" name="cne" placeholder="Enter CNE">
</div>
<div class="form-group">
<label>FirstName</label>
<input value="{{ $student->firstName }}" type="text" class="form-control" name="firstName" placeholder="Enter the first Name">
</div>
<div class="form-group">
<label>Last Name</label>
<input value="{{ $student->LastName }}" type="text" class="form-control" name="LastName" placeholder="Enter the Last Name">
</div>
<div class="form-group">
<label>Age</label>
<input value="{{ $student->age }}" type="text" class="form-control" name="age" placeholder="Enter Age">
</div>
<div class="form-group">
<label>Speciality</label>
<input value="{{ $student->Speciality }}" type="text" class="form-control" name="Speciality" placeholder="Enter the speciality">
</div>
<input type="submit" class="btn btn-info" value="yes">
<input type="submit" class="btn btn-warning" value="reset">
</form>
</div>
</div>
</section>
Firstly, if you want disable input, add readonly to your inputs :
<input value="{{ $student->cne }}" type="text" class="form-control" name="cne" placeholder="Enter CNE" readonly>
Second, now the type of your reset button = submit so when you click it, your form is submitted. Change your code :
<input type="reset" class="btn btn-warning" value="reset">

Form in a modal box is not posting on submiit

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?

Login form using knockout binding doesn't work on Firefox, fine on Chrome

This is utterly bizarre! I have a simple username/password form:
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="LoginUserName" class="col-md-2 control-label">User name</label>
<div class="col-md-10">
<input type="text" id="LoginUserName" class="form-control" data-bind="value: userName, hasFocus: setFocus" />
</div>
</div>
<div class="form-group">
<label for="LoginPassword" class="col-md-2 control-label">Password</label>
<div class="col-md-10">
<input type="password" id="LoginPassword" class="form-control" data-bind="value: password" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input type="checkbox" id="LoginRememberMe" data-bind="checked: rememberMe" />
<label for="LoginRememberMe">Remember me?</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default" data-bind="click: login, disable: session.isBusy()">Log in</button>
</div>
</div>
</form>
First time through, it all works fine and the user is logged in. After logging out and re-entering the user name, the password field is auto-filled. No matter if this is left auto-filled or retyped, when the login method is called, the password field is empty!
If I change the password to an incorrect one it triggers firefox to pop up the "password has changed, do you want to update...?" box at the top of the page. Provided that I answer "yes" to this and then, after that login fails, enter the correct one then it all works and I can log in.
Why on earth is firefox blanking out the password in this circumstance? Completely confused!

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