I have 3 forms in an accordion, one for personal details, billing info and delivery info. I want to autofill the form in the delivery info section if the 'yes' radio button is selected when being asked if their billing and delivery info are the same.
I've looked on the web and can't seem to find anything on filling in a form in an accordion or on the same page.
Here is the HTML:
Details
<img class="editcheckoutbtn" src="<?php echo ROOT; ?>/Images/Buttons/rentals_84x25_edit.png">
<div class="inputsection details">
<form id="detailsform">
<label for="firstname">First Name*</label>
<input type="text" name="forename" />
<label for="lastname">Last Name*</label>
<input type="text" name="surname" />
<label for="email">Email*</label>
<input type="email" name="email" />
<label for="contactnumber">Contact Number*</label>
<input type="text" name="contactnumber"/>
<p class="marketingtext">Do you wish to be contacted by Interski with future promotions?</p>
<label>
<input type="radio" name="marketing" value="yes"/>Yes
</label>
<label>
<input type="radio" name="marketing" value="no"/>No
</label>
<div class="confirmdetailsbtn">
<input type="image" src="<?php echo ROOT; ?>/Images/Buttons/rentals_84x25_confirm.png">
</div>
</form>
</div>
<h3>billing address</h3>
<img class="editcheckoutbtn" src="<?php echo ROOT; ?>/Images/Buttons/rentals_84x25_edit.png">
<div class="inputsection billing">
<form id="billingform">
<label for="firstaddress">1st line of Address*</label>
<input type="text" name="firstaddress"/>
<label for="secondaddress">2nd line of Address</label>
<input type="text" name="secondaddress"/>
<label for="town">Town*</label>
<input type="text" name="town" />
<label for="postcode">Postcode*</label>
<input type="text" name="postcode" />
<label for="country">Country*</label>
<select name="country">
<option></option>
</select>
<p class="billingtext">Is your delivery address the same as your billing address?</p>
<label>
<input type="radio" id="deliveryyes" name="deliveryradio" value="yes"/>Yes
</label>
<label>
<input type="radio" id="deliveryno" name="deliveryradio" value="no"/>No
</label>
<div class="confirmbillingbtn">
<input type="image" src="<?php echo ROOT; ?>/Images/Buttons/rentals_84x25_confirm.png">
</div>
</form>
</div>
<h3>Delivery Address</h3>
<img class="editcheckoutbtn" src="<?php echo ROOT; ?>/Images/Buttons/rentals_84x25_edit.png">
<div class="inputsection delivery">
<form id="deliveryform">
<label for="firstaddress">1st line of Address*</label>
<input type="text" name="delfirstaddress" required/>
<label for="secondaddress">2nd line of Address</label>
<input type="text" name="delsecondaddress"/>
<label for="town">Town*</label>
<input type="text" name="deltown" />
<label for="postcode">Postcode*</label>
<input type="text" name="delpostcode" />
<label for="country">Country*</label>
<select name="delcountry">
<option></option>
</select>
<div class="confirmdeliverybtn">
<input type="image" src="<?php echo ROOT; ?>/Images/Buttons/rentals_84x25_confirm.png">
</div>
<div id="confirmbtn">
<input type="image" src="<?php echo ROOT; ?>/Images/Buttons/rentals_200x38_proceed_to_payment.png">
</div>
This is in complete assumption that as you mentioned its accordion,your page is not refreshed.
You can simply add an event listener on your Radio button to access the required fields and then use them to show wherever required.
Also give proper id's to your input fields
You can do it like this;
$("#deliveryyes").on('click',function(){
var firstaddress = $("#firstaddress").val();
...
// Use those values to populate other fields like
$("#delfirstaddress").val(firstaddress );
...
});
This way you can achieve it.
Related
I have a form that collects data on a persons car (year, color, class, last 4 digits of vin. That same form also has information on the person registering for this event.
When the user clicks the paypal buy now button it should send an email to the person who is accepting the forms as well as redirect the user to paypal so the user can pay the registration fee.
You will see a submit button as well as a buy now button. I basically want the functionality of the submit but the redirection to paypal like the buy now button. Also not sure what the action should be on the form.
<div id="container">
<section id="register">
<form action="mail.php" method="post" accept-charset="utf-8" on>
<h4>Your Jeep</h4>
<div class="form-field">
<fieldset>
<label>Year</label>
<input value="" placeholder="Year" type="text" name="year">
</fieldset>
<fieldset>
<label>Color</label>
<input value="" placeholder="Color" type="text" name="color">
</fieldset>
<fieldset>
<label>Class</label>
<input value="" placeholder="Stock, Modified, Highly Modified" type="text" name="class">
</fieldset>
<!--------------------
<div class="form-field">
<fieldset>
<label>Class</label>
<select class="form-field">
<option value="Select Class">Select Class</option>
<option value="Stock">Stock</option>
<option value="Modified">Modified</option>
<option value="Highly Modified">Highly Modified</option>
</select>
</fieldset>
</div>
------------------------->
<fieldset>
<label>Last 4 digits of VIN</label>
<input value="" placeholder="Last 4 digits of VIN" type="text" name="vin">
</fieldset>
</div>
<h4>You</h4>
<div class="form-field">
<fieldset>
<label>Name</label>
<input value="" placeholder="Name" type="text" name="name">
</fieldset>
</div>
<div class="form-field">
<fieldset>
<label>Address</label>
<input value="" placeholder="Address" type="text" name="address">
</fieldset>
</div>
<div class="form-field">
<fieldset>
<label>City</label>
<input value="" placeholder="City" type="text" name="city">
</fieldset>
</div>
<div class="form-field">
<fieldset>
<label>State</label>
<input value="" placeholder="State" type="text" name="state">
</fieldset>
</div>
<div class="form-field">
<fieldset>
<label>Zip</label>
<input value="" placeholder="Zip" type="text" name="Zip">
</fieldset>
</div>
<div class="form-field">
<fieldset>
<label>Email</label>
<input value="" placeholder="Email" type="text" name="email">
</fieldset>
</div>
<div class="form-button">
<input type="submit" onclick="this.form.submit();"></div>
</form>
<div id="paykim">
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="me#mybusiness.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Jeep Registration">
<input type="hidden" name="amount" value="10.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
<p>Clicking the Submit button will bring you to the official PayPal website where you will be able to send the $10 Registration Fee to </p>
<p id="ekim">Email of person accepting the registrations.</p>
<p id="confirm">You'll recieve a conformation email once your transaction is complete.</p>
</div>
</section>
</div>
http://jsfiddle.net/BsVv5/
I assume you will be store the data in a database. I recommend that first save your form data in the database, Once stored, create a checkout page by querying the database and creates the additional form of paypal. you will require documentation of ipn paypal for sending instant notifications.
https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/
I am making a basic new customer database with mysql and php. I would like when people click on the radio button"different mailing address" for another couple of input fields to appear for the mailing address. Im not quite sure how to handle this with inputs and not variables. Is there a way to do an if statement here is my html form code below
<form method="POST" action="insert.php">
<fieldset>
<legend>New Customer data</legend>
<label>Complete Below</label>
<div class="controls controls-row">
<input class="span4" name="firstname" type="text" placeholder="First name">
<input class="span3" name="lastname" type="text" placeholder="Last Name">
<input class="span3" name="phone" type="text" placeholder="Phone">
</div>
<div class="controls controls-row">
<input class="span4" name="address" type="text" placeholder="Address">
<input class="span2" name="city" type="text" placeholder="City">
<input class="span1" name="state" type="text" placeholder="State">
</div>
<div class="controls controls-row">
<input class="span4" name="zip" type="text" placeholder="Zip Code">
<input class="span2" name="email" type="text" placeholder="Email">
<input class="span2" name="ccemail" type="text" placeholder="cc email">
</div>
<span class="help-block">When is the customers due date monthly</span>
<label class="radio">
<input type="radio" name="duedate" id="optionsRadios1" value="1" checked>
1st of the month</label>
<label class="radio">
<input type="radio" name="duedate" id="optionsRadios2" value="15">
15th of the month
</label>
<span class="help-block">Mailing address</span>
<label class="radio">
<input type="radio" name="mailingaddress" id="optionsRadios3" value="1" checked>
Check if mailing address is the same as the service address
</label>
<label class="radio">
<input type="radio" name="mailingaddress" id="optionsRadios4" value="0">
Check if mailing address is different
</label>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
Using jQuery, have two inputs that are initially hidden. Once the user checks the box, '$.show()' on those two inputs. Id have a div containing two inputs, and just show or hide the div depending on whether the box is checked or not
you can try this.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" >
</script>
<script>
$(document).ready(function(){
$("#checkme").on('change',function(){
if($("#checkme").is(":checked")){
$("input#myemail").fadeIn();
}else{
$("input#myemail").fadeOut();
}
});
});
</script>
</head>
<body>
show: <input type="checkbox" id="checkme" /><br />
<input type="text" id="myemail" hidden />
</body>
</html>
Ok i have a Edit Form in AngularJS and i want show data in textboxes through angular databindings.
Here is the Form which i have done so far.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<link href="<?php echo base_url(); ?>/styles/formcss.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo base_url(); ?>/scripts/angular.min.js"></script>
</head>
<body ng-app>
<div ng-controller="controller">
<form>
<label for="name">UserID:</label> <input type="text" name="UserID" ng-model="user.UserID" value=""><br>
<label for="UserName">Name:</label> <input type="text" name="UserName" ng-model="user.UserName" value=""><br>
<label for="rollno">In Game Name:</label> <input type="text" name="GameName" ng-model="user.InGameName" value="" ><br>
<label for="father">CNIC Number:</label> <input type="number" name="Cnic" ng-model="user.Cnic" value="" ><br>
<label for="age">Age:</label> <input name="Age" ng-model="user.Age" type="number" value="" ><br>
<label for="email1">Email:</label> <input name="Email" ng-model="user.Email" type="email" value="" ><br>
<label for="email2">Res enter Email:</label> <input id="email2" type="email" name="email2" value="" ><br>
<label for="pass1">Password:</label> <input id="pass1" type="password" name="Pass" ng-model="user.Password" value=""><br>
<label for="pass2">Re enter Password:</label> <input id="pass2" type="password" name="pass2" value="" ><br>
<label style="margin-bottom:-10px; " for="male">Male</label><input class="gen" ng-model="user.Gender" id="male" type="radio" name="g" value="Male"><br>
<label style="margin-bottom:15px;" for="female">Female</label><input class="gen" ng-model="user.Gender" id="female" type="radio" name="g" value="Female"><br>
<label class="dis" for="about" >About:</label> <textarea rows="5" cols="40" id="about" type="text" value=""></textarea><br>
<button style="margin-left: 225px;" ng-click="save()" >Save</button>
</form>
</div>
<script>
function controller ($scope,$http)
{
var angularform="<?php echo base_url(); ?>index.php/datacon/angform"
$scope.save=function()
{
$http.post(angularform, $scope.user);
}
}
</script>
</body>
</html>
Here is the Json Array I am Getting From the Controller
JSON:
{"datas":[{"UserID":"168","UserName":"fdaa","Cnic":"23424","Email":"pak#gmail.com","Password":"asdad","Age":"12","Gender":"Male","Picture":null,"InGameName":"fds","ContactID":null,"GroupID":null,"ClanID":null}]}
But How to show these values in TextBoxes through Angular Data bindings?
Or if i am Doing Something Wrong Please Redirect me to my mistakes so i could solve my mistakes.
I am not sure whether I am getting you right or not. But I think If you are using $scope and ng-model, they are doing their job perfectly. You are using absolutely correct.
With the $http.post() you can save the data. At the same time data will be present in the text boxes.
What exactly you want to do. Please explain a bit more so that folks can try to explain you more.
I am currently developing an app and i am getting difficulties on IE8.
I have the following code:
<form class="fillClaimForm" name="fillClaimForm" method="POST" enctype="multipart/form-data" action="<?php print BASE_URL; ?>?action=insertBlogger" >
<label for="fblogName">Blog's name: </label>
<input type="text" name="fblogName" id="fblogName" class="cfInput" placeholder ="Complex" required />
<label for="fblogUrl">URL: </label>
<input type="text" name="fblogUrl" id="fblogUrl" class="cfInput" placeholder ="www.complex.com" required />
<label>Blog's logo: </label>
<div class="upload-file-container"><span>UPLOAD</span>
<input type="file" name="fblogLogo" id="fblogLogo"/>
<p class="ErrLoad error" style="display:none;">Please load your logo</p>
</div>
<label for="fEmail">Email adresse: </label>
<input type="email" name="fEmail" id="fEmail" class="cfInput" required />
<label for="frNum">Phone number: </label>
<input type="tel" name="frNum" id="frNum" class="cfInput" required />
<input type="hidden" name="idVid" id ="idVid" value=""/>
<input type="hidden" name="idRubrique" id ="idRubrique" value=""/>
<button id="sendClaim" class="sendClaim">SEND</button>
Consequently, I am doing a form submission using jquery:
......submit(function(){
validate=false;
formInfo = validateForm(validate,$thisLi);
if(formInfo.validate){
**fillClaimForm.submit();**
}
return false;
});
It is working on all browsers except IE8
Can someone kindly help me.
Thanks
Close your form.
Also give the same name as the id for your form and use
$("#formId").submit();
Code
<form class="fillClaimForm" name="fillClaimForm" method="POST" enctype="multipart/form-data" action="<?php print BASE_URL; ?>?action=insertBlogger" >
<label for="fblogName">Blog's name: </label>
<input type="text" name="fblogName" id="fblogName" class="cfInput" placeholder ="Complex" required />
<label for="fblogUrl">URL: </label>
<input type="text" name="fblogUrl" id="fblogUrl" class="cfInput" placeholder ="www.complex.com" required />
<label>Blog's logo: </label>
<div class="upload-file-container"><span>UPLOAD</span>
<input type="file" name="fblogLogo" id="fblogLogo"/>
<p class="ErrLoad error" style="display:none;">Please load your logo</p>
</div>
<label for="fEmail">Email adresse: </label>
<input type="email" name="fEmail" id="fEmail" class="cfInput" required />
<label for="frNum">Phone number: </label>
<input type="tel" name="frNum" id="frNum" class="cfInput" required />
<input type="hidden" name="idVid" id ="idVid" value=""/>
<input type="hidden" name="idRubrique" id ="idRubrique" value=""/>
<button id="sendClaim" class="sendClaim">SEND</button>
</form>
$("#sendClaim").click(function(){
validate=false;
formInfo = validateForm(validate,$thisLi);
if(formInfo.validate){
$("#fillClaimForm").submit();
}
return false;
});
Try this:
document.forms.fillClaimForm.submit();
Or if the ...... in your code represents creating of a submit handler on that same form you can probably just say this.submit().
I've got a simple one-page form, the kind I've written dozens of times, but this behavior is totally new to me. At first, it was submitting on page-load, thus redirecting automatically to the next page in the series. I'm still not sure how I got that to stop, but now it's not doing anything at all when you hit "submit". The page simply sits there.
I've tried stripping out the error-checking scripts, the show/hide script, even jquery itself, then taking the form down to just one input. I tried getting rid of the redirect and just having it output a simple line, then vardump, and still nothing. I hit submit, and no matter what I do, the page just sits there. I've never run into behavior like this before, and firebug et al give me no errors or leads.
If anyone has any ideas at all, no matter how crazy, I'm willing to try. I'm at a loss. Thanks in advance!
<?php
session_start();
include('functions.php');
if ($_POST['submit']) {
$company = $_POST['company'];
$taxid = $_POST['taxid'];
header("location:step2.php");
}
include('head.php'); ?>
<form method="post" name="basic" action="step1.php">
<div class="col70">
<label for="company">Organization/Business name <img src="img/req.jpg" alt="required"></label>
<input type="text" name="company" id="company" value="" />
</div>
<div class="col30">
<label for="taxid">Taxpayer ID# (IEN or SS#) <img src="img/req.jpg" alt="required"></label>
<input type="text" name="taxid" id="taxid" value="" />
</div>
<div class="newcol">
<label for="address">Mailing Address <img src="img/req.jpg" alt="required"></label>
<input type="text" name="address" id="address" value="" />
</div>
<div class="col30 newcol">
<label for="city">City <img src="img/req.jpg" alt="required"></label>
<input type="text" name="city" id="city" value="" />
</div>
<div class="col30">
<label for="state">State <img src="img/req.jpg" alt="required"></label>
<select name="state" id="state" tabindex="<?php echo $tabin; $tabin++; ?>">
<option value="0"></option>
<option value="1">Alabama</option>
</select>
</div>
<div class="col25">
<label for="zipcode">Zip Code <img src="img/req.jpg" alt="required"></label>
<input type="text" name="zipcode" id="zipcode" value="" />
</div>
<fieldset><legend>1. What kind of group/company do you have? <img src="img/req.jpg" alt="required"></legend>
<span id="nfpfp" class="InputGroup">
<label><input name="nfpfp" id="nfpfp_1" type="radio" value="1" />For-profit business.</label>
<label><input name="nfpfp" id="nfpfp_2" type="radio" value="2" />Non-profit 501(c)3 organization.</label>
</span>
</fieldset>
<fieldset><legend>2. How will you use the booth space? Select all that apply. <img src="img/req.jpg" alt="required"></legend>
<span id="type" class="InputGroup">
<label><input name="food" id="type_1" type="checkbox" value="1" />Food sales</label>
<label><input name="retail" id="type_2" type="checkbox" value="2" />Retail sales</label>
<label><input name="activity" id="type_3" type="checkbox" value="3" />Activity</label>
<label><input name="display" id="type_4" type="checkbox" value="4" />Display</label>
<label><input name="other" id="type_5" type="checkbox" value="5" />Other</label>
</span>
</fieldset>
<label for="otherdetails" class="newcol offsides">Enter a short description of your use. (Ex: "BBQ sandwiches", "kite kits", "face painting".) <img src="img/req.jpg" alt="required"></label>
<input type="text" name="otherdetails" id="otherdetails" value="" />
<fieldset><legend>3. Select any/all that apply. Additional questions may appear, if further information is required.</legend>
<span id="additional" class="InputGroup">
<label><input name="raffle" id="raffle_1" type="checkbox" class="switchcheck1" value="1" />I'll be selling raffle tickets and/or holding a raffle at the festival.</label>
<div class="newcol offstate1">
<label for="raffledetails">You'll need written permission from the Exchange Club. Please enter details about the raffle. <img src="img/req.jpg" alt="required"></label>
<textarea name="raffledetails" id="raffledetails" tabindex="<?php echo $tabin; $tabin++; ?>"></textarea>
</div>
<label><input name="trailer" type="checkbox" id="trailer_1" value="1">I'll be bringing a trailer.</label>
<label><input name="outlets" type="checkbox" id="outlets_1" class="switchcheck2" value="1" />I'll require electrical outlets.</label>
<div class="newcol offstate2">
<label for="outletsdetails">How many outlets will you require? <img src="img/req.jpg" alt="required"></label>
<input type="text" name="outletsdetails" id="outletsdetails" />
</div>
</span>
</fieldset>
<input type="button" name="submit" class="a_button" value="submit" />
</form>
The element with name="submit" is of type button and not submit, so it renders a plain button that does nothing (with the intention that you bind some JavaScript to it).
Use type="submit" instead.
Try
<input type="submit" name="submit" class="a_button" value="submit" />
for your submit button.