Google form with html and individual confirmation page - html

I would like to have a google form on my website and adapt the look of it. I found a description to do so here. The respective code is shown below and can also be seen here (with CSS and result).
I would like to have my own confirmation page (mywebsite.com/signup-confirmation). A comment describes it the way shown below way but I am not sure where exactly to do those changes.
To keep the form from redirecting to a new page. I added to the form,
target="no-target"
Then I created an iframe iframe src="#" id="no-target"
name="no-target" style="visibility:hidden">< /iframe
Now that the form doesnt redirect on submit u can change the location
of the url with javascript window.location.assign(
window.location.hostname;
^ that will redirect you to the homepage
Code from website example:
<header>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css-signup.css">
<div class="wrapper">
<!-- TITLE YOUR FORM -->
<h1>Health Survey</h1>
<h2>Diagnostic for applicants to our fitness program.</h2>
</div>
</header>
<section>
<div class="wrapper">
<!-- START CODING YOUR FORM -->
<form action="https://docs.google.com/a/ladieslearningcode.com/forms/d/e/1FAIpQLSddBVO983YSbAXB7yWkg9Z69CyrY8AAQvUjlhJWtm-7LvdOpQ/formResponse">
<!-- MUTLIPLE CHOICE -->
<p>How often do you exercise?</p>
<div class="input-wrap"><input type="radio" name="entry.1177013199" id="e1" value="1 day a week"/>
<label for="e1">1 day a week</label></div>
<div class="input-wrap"><input type="radio" name="entry.1177013199" id="e2" value="2-3 days a week"/>
<label for="e2">2-3 days a week</label></div>
<div class="input-wrap"><input type="radio" name="entry.1177013199" id="e3" value="4-5 days a week"/>
<label for="e3">4-5 days a week</label></div>
<div class="input-wrap"><input type="radio" name="entry.1177013199" id="e4" value="6+ days a week"/>
<label for="e4">6+ days a week</label></div>
<!-- CHECKBOXES -->
<p>Do you have any food allergies?</p>
<div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a1" value="Milk"/>
<label for="a1">Milk</label></div>
<div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a2" value="Eggs"/>
<label for="a2">Eggs</label></div>
<div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a3" value="Peanuts">
<label for="a3">Peanuts</label></div>
<div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a4" value="Wheat">
<label for="a4">Wheat</label></div>
<div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a5" value="Soy">
<label for="a5">Soy</label></div>
<!-- DROPDOWN -->
<p>What is your favourite food group?</p>
<div class="input-wrap select-box">
<select name="entry.1781742467">
<option selected disabled>Choose</option>
<option value="Fruit">Fruit</option>
<option value="Vegetables">Vegetables</option>
<option value="Grain">Grain</option>
<option value="Meat">Meat</option>
<option value="Dairy">Dairy</option>
</select>
</div>
<!-- SINGLE LINE TEXT FIELD -->
<label for="comfort">What is your go-to comfort food?</label>
<input name="entry.1169089770" type="text" id="comfort"/>
<!-- MULTI-LINE TEXT FIELD -->
<label for="explain">Explain why you want to improve your physical health.</label>
<textarea name="entry.1175247585" id="explain"/></textarea>
<!-- LINEAR SCALE "SLIDER" -->
<label for="explain">Rate your current physical health.</label>
<input name="entry.1672382864" type="range" min="1" max="5" step="1">
<!-- DATE INPUT -->
<label for="explain">When are you available to start training?</label>
<input name="entry.246017384" type="date">
<!-- TIME INPUT -->
<label for="explain">What time of day is best to connect?</label>
<input name="entry.1990206646" type="time">
<!-- SUBMIT BUTTON -->
<input class="button" type="submit" value="Submit">
</form>
</div>

You need to add this piece of code in front of your form tag:
<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location='/thanks.html';}"></iframe>
And this in your form tags:
target="hidden_iframe" onsubmit="submitted=true;"
Everything together looks like this (example):
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location='/thanks.html';}"></iframe>
<form class="form" action="LINK" method="POST" target="hidden_iframe" onsubmit="submitted=true;">
<label>Insert label</label>
<input name="entry.xxx" type="text" required />
<input type="submit" value="Submit" />
</form>

Related

Problems with the ACGIP Conference Project: Script and Element Forms

Ok. I was informed to post one issue at a time so, thus, I will do such. The first issue is the Script and Form Elements. This is what the problem states:
Add a script element to the document head that loads the cg_script.js file.
Scroll down to the section element and insert a web form element that employs the action at http://www.example.com/cg/register via the post method.
Add the labels and input boxes shown previously in the figure in the Introduction step and described in the figure below. Place the input boxes directly after the labels and associate each label with its input box control. You do not need to enclose the label and input elements with div elements.
The issue is that the program will not tell me what is wrong with what I had done so I need some aid to help figure out where to go from here.
The code below detail what I had done for this already. I really have no clue what the program wants from me at this point. Any suggestions would be most appreciated.
<section>
<h1>Conference Registration Form</h1>
<p>Required Item (*)</p>
<form action="http://www.example/cg/register" method="post">
<!-- title -->
<div>
<label for="title">Title</label>
<input type="text" name="title" id="titleBox" list="titleList">
<datalist id="titleList">
<option value="Mr."></option>
<option value="Mrs."></option>
<option value="Ms."></option>
<option value="Prof."></option>
<option value="Dr."></option>
<option value="Assist. Prof."></option>
<option value="Assoc. Prof."></option>
</datalist>
</div>
<!-- firstName -->
<label for="firstName">First Name*</label>
<input type="text" name="firstName" id="fnBox" required>
<!-- LastName -->
<label for="lastName">Last Name*</label>
<input type="text" name="lastName" id="lnBox" required>
<!-- address -->
<label for="address">Address*</label>
<textarea name="address" id="addBox"></textarea>
<!-- Company or University -->
<label for="group">Company or University</label>
<input type="text" name="group" id="groupBox">
<!-- E-mail -->
<label for="email">E-mail*</label>
<input type="email" name="email" id="mailBox" required>
<!-- Phone Number -->
<label for="phoneNumber">Phone Number*</label>
<input type="tel" name="phoneNumber" id="phoneNumber" required pattern="^\d{10}$|^(\(\d{3}\)\s*?\d{3}[\s-]?\d{4}$" placeholder="(nnn) nnn-nnnn">
<!-- ACGIP Membership -->
<label for="acgipID">ACGIP Membership Number</label>
<input type="text" name="acgipID" id="idBox" placeholder="acgip-nnnnnn" pattern="^acgip\-\d{6}$">
<!-- Registration Category -->
<label for="regList">Registration Category</label>
<select id="regList" name="">
<option value="member">ACGIP Member ($695)</option>
<option value="nonmember">ACGIP Non-Member ($795)</option>
<option value="student">ACGIP Student ($310)</option>
<option value="poster">ACGIP Poster ($95)</option>
<option value="guest">ACGIP Guest ($35)</option>
</select>
<!-- Button -->
<p><input type="submit" name="continue" value="Continue"></p>
</form>
</section>
fix the phonenumber code line replace it with this
<!-- Phone Number -->
<label for="phoneNumber">Phone Number*</label>
<input type="text" name="phoneNumber" id="phoneBox" placeholder="(nnn) nnn-nnnn" pattern="^\d{10}$|^(\(\d{3}\)\s*)?\d{3}[\s-]?\d{4}$"required/>

How to target div class within a form?

I have this html which i want to target with css. The problem is that i can't find the right css selector.
The problem is that . entry-content doesn't work. Neither does.event-manager-form. The form itself is a Wordpress event manager form and want to style in with, amongst others,, border-radius
<div class="entry-content">
<form action="/post-an-event/" method="post" id="submit-event-form" class="event-manager-form" enctype="multipart/form-data">
<fieldset>
<label>Your account</label>
<div class="field
account-sign-in">
You are currently signed in as <strong>Bla bla</strong>. <a c class="button" href="...">Sign out</a>.
</div>
</fieldset>
<!-- Event
Information Fields -->
<h2 class="section-title">Event Details</h2>
<fieldset class="fieldset-event_title">
<label for="event_title">Event Title<span class="require-field">*.
</span></label>
<div class="field required-field">
<input type="text" class="input-text event_title" name="event_title" id="event_title" placeholder="Event title" attribute="" value="" maxlength="" required />
</div>
</fieldset>
<fieldset class="fieldset- event_online">
<label for="event_online">Online Event<span class="require-
field">*</span></label>
<div class="field
required-field">
<label><input
type="radio" name="event_online" id="event_online"
attribute="" value="yes" /> Yes</label>
<label><input
type="radio" name="event_online" id="event_online"
attribute="" value="no" /> No</label>

What is wrong with my HTML?

When I add something to my css file to test, nothing happens on the webpage.
Random text so that I can post this without it asking for more details.
<html>
<head>
<title>Basket Gifts</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="container">
<div id="header">
<img src="http://www.displaybanner.com/images/sample_banner.jpg" alt="Banner">
</div> <!--ends the header-->
<div id="main">
<p>Mum & Baby girl gifts<br>
<p>Mum & Baby boy gifts<br>
<p>Nail & Beauty products<br>
<p>Food Hamper<br>
<p>Chocolate Hamper<br>
<p>Fruit Basket<br>
<P>Cheese & Biscuits Hamper<br>
<br><br>
<h3>Select your price range</h3>
<form>
<input type="radio" name="hi" value="value">$30-40</input><br>
<input type="radio" name="hi" value="value">$40-50</input><br>
<input type="radio" name="hi" value="value">$50-60</input><br>
<input type="radio" name="hi" value="value">$60-70</input><br>
<br><br>
<input type="text" name="Name" placeholder="Name"><br>
<input type="text" name="Phone" placeholder="Address"><br>
<input type="text" name="Address" placeholder="Phone Number"><br>
<input type="text" name="email" placeholder="Email Address"><br>
<input type="text" name="confirm email" placeholder="Confirm Email">
</form>
</div> <!--Ends the main content area-->
<div id="footer">
<p>Your Receipt and order confirmation will be sent to your email soon, A confirmation of delivery will be sent three days before the date required.<br> Please not all baskets will be posted. <br>No collections are appplicable.<br>
</div> <!--ends the footer-->
</div> <!--ends the container-->
</body>
What is wrong with this? my css doesnt link to my html file.
style.css:
#container {
background-color: red;
}
#header {
background-color: red;
}
p {
font-family: calibri;
}
Any help would be appreciated.
I did run your code, It works fine.
If even without correct your code, it was also works fine.. I mean your styles are applied in html file.
Here is Image when run your code(without correct your code)
Even though, you missed lots of close tags,
Here is corrected code,
<html>
<head>
<title>Basket Gifts</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="container">
<div id="header">
<img src="http://www.displaybanner.com/images/sample_banner.jpg" alt="Banner">
</div> <!--ends the header-->
<div id="main">
<p>Mum & Baby girl gifts</p><br>
<p>Mum & Baby boy gifts</p><br>
<p>Nail & Beauty products</p><br>
<p>Food Hamper</p><br>
<p>Chocolate Hamper</p><br>
<p>Fruit Basket</p><br>
<P>Cheese & Biscuits Hamper</p><br>
<br><br>
<h3>Select your price range</h3>
<form>
<input type="radio" name="hi" value="value">$30-40</input><br>
<input type="radio" name="hi" value="value">$40-50</input><br>
<input type="radio" name="hi" value="value">$50-60</input><br>
<input type="radio" name="hi" value="value">$60-70</input><br>
<br><br>
<input type="text" name="Name" placeholder="Name"><br>
<input type="text" name="Phone" placeholder="Address"><br>
<input type="text" name="Address" placeholder="Phone Number"><br>
<input type="text" name="email" placeholder="Email Address"><br>
<input type="text" name="confirm email" placeholder="Confirm Email">
</form>
</div> <!--Ends the main content area-->
<div id="footer">
<p>
Your Receipt and order confirmation will be sent to your email soon, A confirmation of delivery will be sent three days before the date required.<br> Please not all baskets will be posted. <br>No collections are appplicable.<br>
</p>
</div> <!--ends the footer-->
</div> <!--ends the container-->
</body>
</html>
You have several wrong in your html code, I added fixed html and css for you:
<!DOCTYPE html>
<html>
<head>
<title>Basket Gifts</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="header" >
<h1>Basket Gifts</h1>
<p>Would you like baskets made and delivered anywhere in New Zealand? Click on the link below to choose what types of basket you want,<br> choose the price range and the the delivery address, and the date required. once all the contact details and the direct credit payment is confirmed,<br> an email will be sent to you confirming delivery, and the number of the track and trace parcel Please allow for two weeks before the requested date.</p>
</div> <!--ends the header-->
<div id="main" >
<p>Mum & Baby girl gifts</p>
<p>Mum & Baby boy gifts</p>
<p>Nail & Beauty products</p>
<p>Food Hamper</p>
<p>Chocolate Hamper</p>
<p>Fruit Basket</p>
<P>Cheese & Biscuits Hamper</p>
<br><br>
<h3>Select your price range</h3>
<form>
<input type="radio" name="hi" value="value" />$30-40<br>
<input type="radio" name="hi" value="value" />$40-50<br>
<input type="radio" name="hi" value="value" />$40-50<br>
<input type="radio" name="hi" value="value" />$60-70<br>
<br><br>
<input type="text" name="Name" placeholder="Name" /><br>
<input type="text" name="Phone" placeholder="Address" /><br>
<input type="text" name="Address" placeholder="Phone Number" /><br>
<input type="text" name="email" placeholder="Email Address" /><br>
<input type="text" name="confirm email" placeholder="Confirm Email" />
</form>
</div> <!--Ends the main content area-->
<div id="footer" >
<p>Your Receipt and order confirmation will be sent to your email soon, A confirmation of delivery will be sent three days before the date required.<br> Please not all baskets will be posted. <br>No collections are appplicable.</p>
</div> <!--ends the footer-->
</body>
</html>
This is the CSS
#container {
background-color: red;
}
#header {
background-color: red;
}
p {
font-family: calibri;
}
#main, #footer, #container, #header {
text-align: center
}

Bootstrap form, how to use with POST

I am working on a class project and I have a webpage to do search:
http://ada.uprrp.edu/~ehazim/hpcf_proj/basicsearch.html
Here is the basic code:
<html>
<head> <title>Search HPCF Inventory</title>
</head>
<body>
<h1> Search </h1>
<form action="results.php" method="POST">
Choose Search Type: <br />
<select name="searchtype">
<option value="ip"> IP Adress </option>
<option value="ss_name"> Software Services </option>
<option value="IS"> ISBN </option>
</select>
<br />
Enter Search Term:<br />
<input name="searchterm" type="text">
<br />
<input type="submit" value="Search">
</form>
</body>
</html>
Now, I want to make it "pretty" using bootstrap 3. I want exactly what I have in my webpage but to be honest, I don't understand the forms of bootstrap (I am new with webpages), mainly how to say that it is by POST and how to put the variable names. I have been looking for this in websites like this: http://bootsnipp.com/forms?version=3
Which looks really cool, but I don't understand how to edit it...
Can someone share the necessary code to have the exact thing that I have in my webpage using bootstrap?
Thanks.
Read through and follow the example at http://getbootstrap.com/css/#forms
So, would end up being
<form action="results.php" method="POST" role="form" class="form-horizontal">
<div class="form-group">
<label for="searchterm" class="col-sm-2 control-label">Choose Search Type</label>
<select name="searchtype" class="form-control">
<option value="ip"> IP Adress </option>
<option value="ss_name"> Software Services </option>
<option value="IS"> ISBN </option>
</select>
</div>
<div class="form-group">
<label for="searchterm" class="col-sm-2 control-label">Choose Search Term</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="searchterm" name="searchterm">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Search</button>
</div>
</div>
</form>

Ajax form submit, can't figure out why it doesn't work

Does anyone have an idea why this does not work? The only data this serializes is the data from page 1. I also tried to have two different functions linked to each of the pages (and I had it as 2 separate forms, allthough then it will only overwrite eachother (and everything else).
<script type="text/javascript">
$(document).ready(function(){
$("#submit").click(function(){
$("#page3").text($("#q").serialize());
});
});
</script>
</head>
<body>
<div data-role="page" id="page1">
<form id="q">
<div data-role="content">
<input type="checkbox" name="4[]" value="1">1</input><br/>
<input type="checkbox" name="4[]" value="2">2</input><br/>
<input type="checkbox" name="4[]" value="3">3</input><br/>
<input type="checkbox" name="4[]" value="4">4</input><br/>
<input type="checkbox" name="asdf[]" value="1">1</input><br/>
<input type="checkbox" name="asdf[]" value="2">2</input><br/>
</div>
<a data-role="button" href="#page2">Next</a>
</div>
<div data-role="page" id="page2">
<div data-role="content">
<input type="checkbox" name="3[]" value="11">11</input><br/>
<input type="checkbox" name="3[]" value="21">21</input><br/>
<input type="checkbox" name="adf[]" value="1">11</input><br/>
<input type="checkbox" name="adf[]" value="2">12</input><br/>
</div>
</form>
<a data-role="button" type="submit" href="#page3" id="submit">Next</a>
</div>
<div data-role="page" id="page3">
</div>
Your problem likely has something to do with how you have your first form interleaved with the outer divs - not permitted in HTML, not sure what the browser will make of this. Can you close your first form within the div, start a new form inside the page 2 div?
its because all the checkboxs is not checked
, try this